★レポートの説明★

このレポートは、原稿"Highly Sensitive Adolescent Benefits in Positive School Transitions"の結果をまとめたものである。結果の構成は以下のとおり。
  • (1)前処理
  • (2)記述統計量と可視化
  • (3)因子分析
  • (4)精神的健康の潜在変化得点算出
  • (5)HSCのクラスタ抽出
  • (6)環境変化→健康変化の単回帰分析
  • (7)HSCグループごとの分位点回帰(感度分析として)
  • (8)階層的重回帰分析

(1)前処理

1-1. ローデータの読み込みと2時点データ結合

#前処理に必要なパッケージ読み込み
library(tidyverse)
## -- Attaching packages ---------------------------------------------------------------- tidyverse 1.2.1 --
## √ ggplot2 2.2.1     √ purrr   0.2.5
## √ tibble  1.4.2     √ dplyr   0.7.6
## √ tidyr   0.8.1     √ stringr 1.3.0
## √ readr   1.1.1     √ forcats 0.3.0
## -- Conflicts ------------------------------------------------------------------- tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
#各時点のローデータ読み込み
DataSourceT1 <- read_csv("Time1_rawdata.csv", na = c(".", "")) #Time1のローデータ読み込み
## Parsed with column specification:
## cols(
##   .default = col_integer()
## )
## See spec(...) for full column specifications.
DataSourceT2 <- read_csv("Time2_rawdata.csv", na = c(".", "")) #Time2のローデータ読み込み
## Parsed with column specification:
## cols(
##   .default = col_integer()
## )
## See spec(...) for full column specifications.
head(DataSourceT1) #先頭6行確認
head(DataSourceT2) #先頭6行確認
#各時点のローデータの結合
DataSource <- full_join(DataSourceT1, DataSourceT2, by = "ID", na = c(".", ""))
  #full_join(データ1, データ2, by = 共通のキー変数名)
head(DataSource) #先頭6行確認
tail(DataSource) #末尾6行確認
names(DataSource) #変数名確認
##   [1] "ID"                "gardian_gender_T1" "gardian_age_T1"   
##   [4] "prefecture_T1"     "area_T1"           "married_T1"       
##   [7] "familyincome_T1"   "pinincome_T1"      "job_T1"           
##  [10] "child_gender_T1"   "hsc1_T1"           "hsc2_T1"          
##  [13] "hsc3_T1"           "hsc4_T1"           "hsc5_T1"          
##  [16] "hsc6_T1"           "hsc7_T1"           "hsc8_T1"          
##  [19] "hsc9_T1"           "hsc10_T1"          "hsc11_T1"         
##  [22] "hsc12_T1"          "health1_T1"        "health2_T1"       
##  [25] "health3_T1"        "health4_T1"        "health5_T1"       
##  [28] "panas1_T1"         "panas2_T1"         "panas3_T1"        
##  [31] "panas4_T1"         "panas5_T1"         "panas6_T1"        
##  [34] "panas7_T1"         "panas8_T1"         "panas9_T1"        
##  [37] "panas10_T1"        "panas11_T1"        "panas12_T1"       
##  [40] "panas13_T1"        "panas14_T1"        "panas15_T1"       
##  [43] "panas16_T1"        "gardian_gender_T2" "gardian_age_T2"   
##  [46] "prefecture_T2"     "area_T2"           "married_T2"       
##  [49] "familyincome_T2"   "pinincome_T2"      "job_T2"           
##  [52] "child_gender_T2"   "environment1_T2"   "environment2_T2"  
##  [55] "environment3_T2"   "environment4_T2"   "environment5_T2"  
##  [58] "environment6_T2"   "environment7_T2"   "environment8_T2"  
##  [61] "environment9_T2"   "environment10_T2"  "environment11_T2" 
##  [64] "hsc1_T2"           "hsc2_T2"           "hsc3_T2"          
##  [67] "hsc4_T2"           "hsc5_T2"           "hsc6_T2"          
##  [70] "hsc7_T2"           "hsc8_T2"           "hsc9_T2"          
##  [73] "hsc10_T2"          "hsc11_T2"          "hsc12_T2"         
##  [76] "health1_T2"        "health2_T2"        "health3_T2"       
##  [79] "health4_T2"        "health5_T2"        "bis1r_T2"         
##  [82] "bas1_T2"           "bas2_T2"           "bas3_T2"          
##  [85] "bas4_T2"           "bis2_T2"           "bas5_T2"          
##  [88] "bas6_T2"           "bas7_T2"           "bis3_T2"          
##  [91] "bas8_T2"           "bas9_T2"           "bis4_T2"          
##  [94] "bas10_T2"          "bis5_T2"           "bas11_T2"         
##  [97] "bas12_T2"          "bis6r_T2"          "bas13_T2"         
## [100] "bis7_T2"

1-2. 合計得点の算出と列追加

#合計得点の算出と列の追加:インプットデータ作成(# 参考として徳岡さんの資料参考http://rpubs.com/t_macya/333965)
InputData <- DataSource %>% 
  dplyr::mutate(bis1_T2 = 5 - bis1r_T2) %>% #bis1r_T2を逆転しbis1_T2という列を追加
  dplyr::mutate(bis6_T2 = 5 - bis6r_T2) %>% #bis1r_T2を逆転しbis1_T2という列を追加

#HSCSの易興奮性得点算出(T1とT2)
  dplyr::mutate(eoe_mean_T1 = (hsc8_T1 + hsc6_T1 + hsc4_T1 + hsc9_T1+ hsc12_T1)/5, na.rm = TRUE) %>% #T1
  dplyr::mutate(eoe_mean_T2 = (hsc8_T2 + hsc6_T2 + hsc4_T2 + hsc9_T2+ hsc12_T2)/5, na.rm = TRUE) %>% #T2
  
#HSCSの低閾値得点算出(T1とT2)
  dplyr::mutate(lst_mean_T1 = (hsc2_T1 + hsc11_T1)/2, na.rm = TRUE) %>% #T1
  dplyr::mutate(lst_mean_T2 = (hsc2_T2 + hsc11_T2)/2, na.rm = TRUE) %>% #T2
  
#HSCSの美的感受性得点算出(T1とT2)
  dplyr::mutate(aes_mean_T1 = (hsc5_T1 + hsc10_T1 + hsc1_T1 + hsc3_T1)/4, na.rm = TRUE) %>% #T1
  dplyr::mutate(aes_mean_T2 = (hsc5_T2 + hsc10_T2 + hsc1_T2 + hsc3_T2)/4, na.rm = TRUE) %>% #T2
  
#HSCSの合計平均得点算出(T1とT2)
  dplyr::mutate(hsc_mean_T1 = (eoe_mean_T1 + lst_mean_T1 + aes_mean_T1)/3, na.rm = TRUE) %>% #T1
  dplyr::mutate(hsc_mean_T2 = (eoe_mean_T2 + lst_mean_T2 + aes_mean_T2)/3, na.rm = TRUE) %>% #T2

#精神的健康の合計得点算出(T1とT2)
  dplyr::mutate(health_mean_T1 = (health1_T1 + health2_T1 + health2_T1 + health4_T1 + health5_T1)/5, na.rm = TRUE) %>% #T1
  dplyr::mutate(health_mean_T2 = (health1_T2 + health2_T2 + health2_T2 + health4_T2 + health5_T2)/5, na.rm = TRUE) %>% #T2

#PANASのpositive得点算出(T1)
  dplyr::mutate(positive_mean_T1 = (panas2_T1 + panas4_T1 + panas6_T1 + panas8_T1 + panas10_T1 + panas12_T1 + panas14_T1 + panas16_T1)/8, na.rm = TRUE) %>% #T1
  
#PANASのnegative得点算出(T1)
  dplyr::mutate(negative_mean_T1 = (panas1_T1 + panas3_T1 + panas5_T1 + panas7_T1 + panas9_T1 + panas11_T1 + panas13_T1 + panas15_T1)/8, na.rm = TRUE) %>% #T1
  
#学校環境変化尺度の合計得点算出(T2)
  dplyr::mutate(environment_mean_T2 = (environment1_T2 + environment2_T2 + environment3_T2 + environment4_T2 + environment5_T2 + environment6_T2 + environment7_T2 + environment8_T2 + environment9_T2 + environment10_T2 + environment11_T2)/11, na.rm = TRUE) %>% #T2
  
#BISの得点算出(T2)
  dplyr::mutate(bis_mean_T2 = (bis1_T2 + bis2_T2 + bis3_T2 + bis4_T2 + bis5_T2 + bis6_T2 + bis7_T2)/7, na.rm = TRUE) %>% #T2
  
#BASの得点算出(T2)
  dplyr::mutate(bas_mean_T2 = (bas1_T2 + bas2_T2 + bas3_T2 + bas4_T2 + bas5_T2 + bas6_T2 + bas7_T2 + bas8_T2 + bas9_T2 + bas10_T2 + bas11_T2 + bas12_T2 + bas13_T2)/7, na.rm = TRUE) #T2
  
#インプットデータの確認
head(InputData) #先頭6行確認
names(InputData) #変数名確認
##   [1] "ID"                  "gardian_gender_T1"   "gardian_age_T1"     
##   [4] "prefecture_T1"       "area_T1"             "married_T1"         
##   [7] "familyincome_T1"     "pinincome_T1"        "job_T1"             
##  [10] "child_gender_T1"     "hsc1_T1"             "hsc2_T1"            
##  [13] "hsc3_T1"             "hsc4_T1"             "hsc5_T1"            
##  [16] "hsc6_T1"             "hsc7_T1"             "hsc8_T1"            
##  [19] "hsc9_T1"             "hsc10_T1"            "hsc11_T1"           
##  [22] "hsc12_T1"            "health1_T1"          "health2_T1"         
##  [25] "health3_T1"          "health4_T1"          "health5_T1"         
##  [28] "panas1_T1"           "panas2_T1"           "panas3_T1"          
##  [31] "panas4_T1"           "panas5_T1"           "panas6_T1"          
##  [34] "panas7_T1"           "panas8_T1"           "panas9_T1"          
##  [37] "panas10_T1"          "panas11_T1"          "panas12_T1"         
##  [40] "panas13_T1"          "panas14_T1"          "panas15_T1"         
##  [43] "panas16_T1"          "gardian_gender_T2"   "gardian_age_T2"     
##  [46] "prefecture_T2"       "area_T2"             "married_T2"         
##  [49] "familyincome_T2"     "pinincome_T2"        "job_T2"             
##  [52] "child_gender_T2"     "environment1_T2"     "environment2_T2"    
##  [55] "environment3_T2"     "environment4_T2"     "environment5_T2"    
##  [58] "environment6_T2"     "environment7_T2"     "environment8_T2"    
##  [61] "environment9_T2"     "environment10_T2"    "environment11_T2"   
##  [64] "hsc1_T2"             "hsc2_T2"             "hsc3_T2"            
##  [67] "hsc4_T2"             "hsc5_T2"             "hsc6_T2"            
##  [70] "hsc7_T2"             "hsc8_T2"             "hsc9_T2"            
##  [73] "hsc10_T2"            "hsc11_T2"            "hsc12_T2"           
##  [76] "health1_T2"          "health2_T2"          "health3_T2"         
##  [79] "health4_T2"          "health5_T2"          "bis1r_T2"           
##  [82] "bas1_T2"             "bas2_T2"             "bas3_T2"            
##  [85] "bas4_T2"             "bis2_T2"             "bas5_T2"            
##  [88] "bas6_T2"             "bas7_T2"             "bis3_T2"            
##  [91] "bas8_T2"             "bas9_T2"             "bis4_T2"            
##  [94] "bas10_T2"            "bis5_T2"             "bas11_T2"           
##  [97] "bas12_T2"            "bis6r_T2"            "bas13_T2"           
## [100] "bis7_T2"             "bis1_T2"             "bis6_T2"            
## [103] "eoe_mean_T1"         "na.rm"               "eoe_mean_T2"        
## [106] "lst_mean_T1"         "lst_mean_T2"         "aes_mean_T1"        
## [109] "aes_mean_T2"         "hsc_mean_T1"         "hsc_mean_T2"        
## [112] "health_mean_T1"      "health_mean_T2"      "positive_mean_T1"   
## [115] "negative_mean_T1"    "environment_mean_T2" "bis_mean_T2"        
## [118] "bas_mean_T2"

(2)記述統計量と可視化

楽に可視化したいなら以下のコードでGUI上のPlotlyタブをいじればOK! * library(ggplotgui) * ggplot_shiny(dataset = InputData)

2-1. 全変数の度数分布

2-1-1. 性別の度数分布

#child_gender_T1の度数分布
child_gender_count_T1 <- dplyr::count(InputData, child_gender_T1)
knitr::kable(child_gender_count_T1) #テーブル化
child_gender_T1 n
0 206
1 206
ggplot(data = InputData, mapping = aes(x = child_gender_T1, fill = factor(child_gender_T1))) + geom_bar() #視覚化

#child_gender_T2の度数分布
child_gender_count_T2 <- dplyr::count(InputData, child_gender_T2)
knitr::kable(child_gender_count_T2) #テーブル化
child_gender_T2 n
0 174
1 170
NA 68
ggplot(data = InputData, mapping = aes(x = child_gender_T2, fill = factor(child_gender_T2))) + geom_bar() #視覚化

2-1-2. HSCSの度数分布

#hsc1_T1の度数分布
hsc1_T1_count <- dplyr::count(InputData, hsc1_T1)
knitr::kable(hsc1_T1_count) #テーブル化
hsc1_T1 n
1 8
2 30
3 57
4 147
5 114
6 41
7 15
ggplot(data = InputData, mapping = aes(x = hsc1_T1, fill = factor(hsc1_T1))) + geom_histogram(binwidth = 1) #視覚化

#hsc2_T1の度数分布
hsc2_T1_count <- dplyr::count(InputData, hsc2_T1)
knitr::kable(hsc2_T1_count) #テーブル化
hsc2_T1 n
1 27
2 35
3 56
4 118
5 102
6 56
7 18
ggplot(data = InputData, mapping = aes(x = hsc2_T1, fill = factor(hsc2_T1))) + geom_histogram(binwidth = 1) #視覚化

#hsc3_T1の度数分布
hsc3_T1_count <- dplyr::count(InputData, hsc3_T1)
knitr::kable(hsc3_T1_count) #テーブル化
hsc3_T1 n
1 12
2 14
3 46
4 114
5 103
6 77
7 46
ggplot(data = InputData, mapping = aes(x = hsc3_T1, fill = factor(hsc3_T1))) + geom_histogram(binwidth = 1) #視覚化

#hsc4_T1の度数分布
hsc4_T1_count <- dplyr::count(InputData, hsc4_T1)
knitr::kable(hsc4_T1_count) #テーブル化
hsc4_T1 n
1 25
2 27
3 67
4 117
5 109
6 45
7 22
ggplot(data = InputData, mapping = aes(x = hsc4_T1, fill = factor(hsc4_T1))) + geom_histogram(binwidth = 1) #視覚化

#hsc5_T1の度数分布
hsc5_T1_count <- dplyr::count(InputData, hsc5_T1)
knitr::kable(hsc5_T1_count) #テーブル化
hsc5_T1 n
1 9
2 14
3 26
4 77
5 90
6 100
7 96
ggplot(data = InputData, mapping = aes(x = hsc5_T1, fill = factor(hsc5_T1))) + geom_histogram(binwidth = 1) #視覚化

#hsc6_T1の度数分布
hsc6_T1_count <- dplyr::count(InputData, hsc6_T1)
knitr::kable(hsc6_T1_count) #テーブル化
hsc6_T1 n
1 7
2 15
3 37
4 104
5 120
6 83
7 46
ggplot(data = InputData, mapping = aes(x = hsc6_T1, fill = factor(hsc6_T1))) + geom_histogram(binwidth = 1) #視覚化

#hsc7_T1の度数分布
hsc7_T1_count <- dplyr::count(InputData, hsc7_T1)
knitr::kable(hsc7_T1_count) #テーブル化
hsc7_T1 n
1 6
2 18
3 49
4 116
5 81
6 87
7 55
ggplot(data = InputData, mapping = aes(x = hsc7_T1, fill = factor(hsc7_T1))) + geom_histogram(binwidth = 1) #視覚化

#hsc8_T1の度数分布
hsc8_T1_count <- dplyr::count(InputData, hsc8_T1)
knitr::kable(hsc8_T1_count) #テーブル化
hsc8_T1 n
1 13
2 13
3 51
4 161
5 94
6 54
7 26
ggplot(data = InputData, mapping = aes(x = hsc8_T1, fill = factor(hsc8_T1))) + geom_histogram(binwidth = 1) #視覚化

#hsc9_T1の度数分布
hsc9_T1_count <- dplyr::count(InputData, hsc9_T1)
knitr::kable(hsc9_T1_count) #テーブル化
hsc9_T1 n
1 8
2 28
3 76
4 162
5 78
6 45
7 15
ggplot(data = InputData, mapping = aes(x = hsc9_T1, fill = factor(hsc9_T1))) + geom_histogram(binwidth = 1) #視覚化

#hsc10_T1の度数分布
hsc10_T1_count <- dplyr::count(InputData, hsc10_T1)
knitr::kable(hsc10_T1_count) #テーブル化
hsc10_T1 n
1 8
2 16
3 18
4 36
5 71
6 121
7 142
ggplot(data = InputData, mapping = aes(x = hsc10_T1, fill = factor(hsc10_T1))) + geom_histogram(binwidth = 1) #視覚化

#hsc11_T1の度数分布
hsc11_T1_count <- dplyr::count(InputData, hsc11_T1)
knitr::kable(hsc11_T1_count) #テーブル化
hsc11_T1 n
1 5
2 19
3 48
4 138
5 91
6 69
7 42
ggplot(data = InputData, mapping = aes(x = hsc11_T1, fill = factor(hsc11_T1))) + geom_histogram(binwidth = 1) #視覚化

#hsc12_T1の度数分布
hsc12_T1_count <- dplyr::count(InputData, hsc12_T1)
knitr::kable(hsc12_T1_count) #テーブル化
hsc12_T1 n
1 11
2 17
3 45
4 130
5 109
6 60
7 40
ggplot(data = InputData, mapping = aes(x = hsc12_T1, fill = factor(hsc12_T1))) + geom_histogram(binwidth = 1) #視覚化

#eoe_mean_T1の度数分布
eoe_T1_count <- dplyr::count(InputData, eoe_mean_T1)
knitr::kable(eoe_T1_count) #テーブル化
eoe_mean_T1 n
1.0 2
1.2 1
1.8 2
2.0 1
2.2 3
2.4 2
2.6 5
2.8 3
3.0 9
3.2 5
3.4 11
3.6 27
3.8 38
4.0 49
4.2 42
4.4 36
4.6 32
4.8 29
5.0 23
5.2 23
5.4 20
5.6 11
5.8 12
6.0 5
6.2 8
6.4 5
6.6 3
6.8 2
7.0 3
ggplot(data = InputData, mapping = aes(x = eoe_mean_T1, fill = factor(eoe_mean_T1))) + geom_histogram(binwidth = 0.2) #視覚化

#lst_mean_T1の度数分布
lst_T1_count <- dplyr::count(InputData, lst_mean_T1)
knitr::kable(lst_T1_count) #テーブル化
lst_mean_T1 n
1.0 3
1.5 4
2.0 8
2.5 22
3.0 30
3.5 45
4.0 85
4.5 67
5.0 53
5.5 38
6.0 29
6.5 15
7.0 13
ggplot(data = InputData, mapping = aes(x = lst_mean_T1, fill = factor(lst_mean_T1))) + geom_histogram(binwidth = 0.4) #視覚化

#aes_mean_T1の度数分布
aes_T1_count <- dplyr::count(InputData, aes_mean_T1)
knitr::kable(aes_T1_count) #テーブル化
aes_mean_T1 n
1.00 1
1.25 1
1.75 1
2.00 2
2.25 2
2.50 2
2.75 4
3.00 6
3.25 10
3.50 13
3.75 18
4.00 28
4.25 20
4.50 39
4.75 30
5.00 49
5.25 39
5.50 45
5.75 23
6.00 25
6.25 26
6.50 18
6.75 5
7.00 5
ggplot(data = InputData, mapping = aes(x = aes_mean_T1, fill = factor(aes_mean_T1))) + geom_histogram(binwidth = 0.3) #視覚化

#hsc_mean_T1の度数分布
hsc_T1_count <- dplyr::count(InputData, hsc_mean_T1)
knitr::kable(hsc_T1_count) #テーブル化
hsc_mean_T1 n
1.000000 1
2.150000 2
2.216667 1
2.733333 1
2.750000 1
2.833333 1
2.916667 1
2.933333 1
2.966667 1
3.200000 1
3.250000 1
3.266667 1
3.300000 2
3.316667 2
3.333333 1
3.366667 1
3.383333 1
3.400000 2
3.416667 2
3.433333 2
3.450000 2
3.483333 2
3.500000 1
3.516667 4
3.533333 2
3.550000 2
3.600000 1
3.616667 2
3.650000 1
3.666667 2
3.683333 2
3.700000 3
3.733333 1
3.750000 4
3.766667 1
3.783333 2
3.816667 3
3.833333 5
3.850000 4
3.866667 4
3.883333 1
3.900000 1
3.916667 1
3.933333 4
3.950000 1
3.966667 1
3.983333 3
4.000000 9
4.016667 4
4.033333 1
4.050000 4
4.066667 4
4.083333 2
4.100000 5
4.116667 3
4.133333 3
4.150000 1
4.166667 5
4.183333 3
4.200000 4
4.216667 3
4.233333 4
4.250000 3
4.266667 4
4.283333 2
4.300000 3
4.316667 2
4.333333 4
4.350000 4
4.366667 5
4.383333 1
4.400000 3
4.416667 5
4.433333 1
4.450000 4
4.466667 5
4.483333 1
4.500000 3
4.516667 3
4.533333 3
4.550000 2
4.566667 2
4.583333 3
4.600000 10
4.616667 3
4.633333 6
4.650000 5
4.666667 5
4.683333 4
4.700000 8
4.733333 5
4.750000 2
4.766667 3
4.783333 2
4.800000 6
4.816667 5
4.833333 5
4.850000 2
4.866667 2
4.883333 2
4.900000 4
4.916667 3
4.933333 3
4.950000 1
4.966667 5
4.983333 2
5.000000 1
5.016667 3
5.033333 3
5.066667 1
5.083333 1
5.100000 1
5.133333 3
5.150000 4
5.166667 3
5.200000 1
5.216667 4
5.233333 4
5.250000 2
5.266667 3
5.283333 4
5.300000 4
5.316667 1
5.333333 2
5.350000 1
5.383333 3
5.400000 1
5.416667 1
5.433333 2
5.450000 3
5.466667 1
5.483333 4
5.500000 4
5.516667 3
5.533333 4
5.566667 2
5.583333 1
5.600000 2
5.633333 1
5.650000 1
5.666667 1
5.716667 1
5.766667 1
5.783333 1
5.800000 2
5.816667 5
5.833333 1
5.850000 2
5.866667 1
5.883333 1
5.900000 1
5.933333 1
5.950000 2
6.033333 2
6.050000 1
6.083333 1
6.100000 1
6.116667 1
6.150000 1
6.166667 2
6.233333 1
6.300000 1
6.333333 1
6.466667 1
6.550000 1
6.800000 1
7.000000 1
ggplot(data = InputData, mapping = aes(x = hsc_mean_T1, fill = factor(hsc_mean_T1))) + 
  geom_histogram(binwidth = 0.3) + guides(fill = "none") #視覚化

#hsc1_T2の度数分布
hsc1_T2_count <- dplyr::count(InputData, hsc1_T2)
knitr::kable(hsc1_T2_count) #テーブル化
hsc1_T2 n
1 6
2 16
3 43
4 160
5 89
6 24
7 6
NA 68
ggplot(data = InputData, mapping = aes(x = hsc1_T2, fill = factor(hsc1_T2))) + geom_histogram(binwidth = 1) #視覚化

#hsc2_T2の度数分布
hsc2_T2_count <- dplyr::count(InputData, hsc2_T2)
knitr::kable(hsc2_T2_count) #テーブル化
hsc2_T2 n
1 14
2 21
3 74
4 113
5 84
6 28
7 10
NA 68
ggplot(data = InputData, mapping = aes(x = hsc2_T2, fill = factor(hsc2_T2))) + geom_histogram(binwidth = 1) #視覚化

#hsc3_T2の度数分布
hsc3_T2_count <- dplyr::count(InputData, hsc3_T2)
knitr::kable(hsc3_T2_count) #テーブル化
hsc3_T2 n
1 3
2 14
3 28
4 109
5 102
6 57
7 31
NA 68
ggplot(data = InputData, mapping = aes(x = hsc3_T2, fill = factor(hsc3_T2))) + geom_histogram(binwidth = 1) #視覚化

#hsc4_T2の度数分布
hsc4_T2_count <- dplyr::count(InputData, hsc4_T2)
knitr::kable(hsc4_T2_count) #テーブル化
hsc4_T2 n
1 10
2 16
3 50
4 129
5 102
6 24
7 13
NA 68
ggplot(data = InputData, mapping = aes(x = hsc4_T2, fill = factor(hsc4_T2))) + geom_histogram(binwidth = 1) #視覚化

#hsc5_T2の度数分布
hsc5_T2_count <- dplyr::count(InputData, hsc5_T2)
knitr::kable(hsc5_T2_count) #テーブル化
hsc5_T2 n
1 4
2 10
3 15
4 74
5 88
6 71
7 82
NA 68
ggplot(data = InputData, mapping = aes(x = hsc5_T2, fill = factor(hsc5_T2))) + geom_histogram(binwidth = 1) #視覚化

#hsc6_T2の度数分布
hsc6_T2_count <- dplyr::count(InputData, hsc6_T2)
knitr::kable(hsc6_T2_count) #テーブル化
hsc6_T2 n
1 5
2 5
3 25
4 113
5 100
6 60
7 36
NA 68
ggplot(data = InputData, mapping = aes(x = hsc6_T2, fill = factor(hsc6_T2))) + geom_histogram(binwidth = 1) #視覚化

#hsc7_T2の度数分布
hsc7_T2_count <- dplyr::count(InputData, hsc7_T2)
knitr::kable(hsc7_T2_count) #テーブル化
hsc7_T2 n
1 7
2 10
3 25
4 116
5 81
6 57
7 48
NA 68
ggplot(data = InputData, mapping = aes(x = hsc7_T2, fill = factor(hsc7_T2))) + geom_histogram(binwidth = 1) #視覚化

#hsc8_T2の度数分布
hsc8_T2_count <- dplyr::count(InputData, hsc8_T2)
knitr::kable(hsc8_T2_count) #テーブル化
hsc8_T2 n
1 5
2 11
3 24
4 153
5 90
6 40
7 21
NA 68
ggplot(data = InputData, mapping = aes(x = hsc8_T2, fill = factor(hsc8_T2))) + geom_histogram(binwidth = 1) #視覚化

#hsc9_T2の度数分布
hsc9_T2_count <- dplyr::count(InputData, hsc9_T2)
knitr::kable(hsc9_T2_count) #テーブル化
hsc9_T2 n
1 5
2 17
3 55
4 163
5 67
6 28
7 9
NA 68
ggplot(data = InputData, mapping = aes(x = hsc9_T2, fill = factor(hsc9_T2))) + geom_histogram(binwidth = 1) #視覚化

#hsc10_T2の度数分布
hsc10_T2_count <- dplyr::count(InputData, hsc10_T2)
knitr::kable(hsc10_T2_count) #テーブル化
hsc10_T2 n
1 2
2 5
3 9
4 62
5 69
6 95
7 102
NA 68
ggplot(data = InputData, mapping = aes(x = hsc10_T2, fill = factor(hsc10_T2))) + geom_histogram(binwidth = 1) #視覚化

#hsc11_T2の度数分布
hsc11_T2_count <- dplyr::count(InputData, hsc11_T2)
knitr::kable(hsc11_T2_count) #テーブル化
hsc11_T2 n
1 3
2 19
3 35
4 113
5 86
6 57
7 31
NA 68
ggplot(data = InputData, mapping = aes(x = hsc11_T2, fill = factor(hsc11_T2))) + geom_histogram(binwidth = 1) #視覚化

#hsc12_T2の度数分布
hsc12_T2_count <- dplyr::count(InputData, hsc12_T2)
knitr::kable(hsc12_T2_count) #テーブル化
hsc12_T2 n
1 6
2 10
3 27
4 135
5 87
6 54
7 25
NA 68
ggplot(data = InputData, mapping = aes(x = hsc12_T2, fill = factor(hsc12_T2))) + geom_histogram(binwidth = 1) #視覚化

#eoe_mean_T2の度数分布
eoe_T2_count <- dplyr::count(InputData, eoe_mean_T2)
knitr::kable(eoe_T2_count) #テーブル化
eoe_mean_T2 n
1.0 2
1.6 1
2.0 1
2.2 3
2.4 1
2.6 3
2.8 1
3.0 4
3.2 5
3.4 5
3.6 12
3.8 25
4.0 69
4.2 36
4.4 35
4.6 27
4.8 22
5.0 19
5.2 22
5.4 14
5.6 7
5.8 8
6.0 2
6.2 6
6.4 7
6.6 2
6.8 3
7.0 2
NA 68
ggplot(data = InputData, mapping = aes(x = eoe_mean_T2, fill = factor(eoe_mean_T2))) + geom_histogram(binwidth = 0.2) #視覚化

#lst_mean_T2の度数分布
lst_T2_count <- dplyr::count(InputData, lst_mean_T2)
knitr::kable(lst_T2_count) #テーブル化
lst_mean_T2 n
1.0 1
1.5 4
2.0 8
2.5 11
3.0 22
3.5 43
4.0 98
4.5 44
5.0 36
5.5 43
6.0 20
6.5 8
7.0 6
NA 68
ggplot(data = InputData, mapping = aes(x = lst_mean_T2, fill = factor(lst_mean_T2))) + geom_histogram(binwidth = 0.4) #視覚化

#aes_mean_T2の度数分布
aes_T2_count <- dplyr::count(InputData, aes_mean_T2)
knitr::kable(aes_T2_count) #テーブル化
aes_mean_T2 n
2.00 1
2.25 1
2.75 1
3.00 5
3.25 4
3.50 9
3.75 11
4.00 36
4.25 32
4.50 29
4.75 39
5.00 37
5.25 29
5.50 26
5.75 28
6.00 28
6.25 13
6.50 7
6.75 3
7.00 5
NA 68
ggplot(data = InputData, mapping = aes(x = aes_mean_T2, fill = factor(aes_mean_T2))) + geom_histogram(binwidth = 0.3) #視覚化

#hsc_mean_T2の度数分布
hsc_T2_count <- dplyr::count(InputData, hsc_mean_T2)
knitr::kable(hsc_T2_count) #テーブル化
hsc_mean_T2 n
1.750000 1
2.433333 1
2.733333 1
2.866667 1
2.950000 1
3.166667 1
3.200000 1
3.216667 1
3.250000 1
3.333333 2
3.400000 1
3.433333 2
3.466667 1
3.500000 1
3.533333 1
3.616667 2
3.633333 2
3.666667 2
3.683333 1
3.733333 2
3.750000 3
3.766667 3
3.783333 1
3.800000 1
3.816667 2
3.833333 5
3.850000 3
3.866667 1
3.883333 1
3.900000 1
3.916667 5
3.933333 2
3.950000 3
3.966667 1
3.983333 3
4.000000 20
4.016667 1
4.033333 1
4.050000 3
4.066667 3
4.083333 3
4.100000 4
4.133333 3
4.150000 3
4.166667 5
4.183333 3
4.200000 2
4.216667 4
4.233333 4
4.250000 8
4.266667 1
4.283333 1
4.300000 2
4.316667 4
4.333333 5
4.350000 1
4.366667 4
4.383333 2
4.400000 3
4.416667 4
4.433333 3
4.450000 5
4.466667 4
4.483333 1
4.500000 3
4.516667 4
4.550000 4
4.566667 4
4.583333 2
4.600000 1
4.616667 4
4.633333 2
4.650000 4
4.666667 5
4.683333 5
4.700000 4
4.716667 3
4.733333 3
4.750000 1
4.766667 2
4.783333 6
4.800000 2
4.816667 7
4.833333 2
4.850000 1
4.866667 1
4.883333 5
4.900000 7
4.916667 1
4.933333 3
4.983333 2
5.000000 4
5.016667 2
5.033333 3
5.050000 1
5.066667 1
5.083333 3
5.100000 3
5.116667 2
5.133333 3
5.166667 1
5.183333 2
5.216667 2
5.233333 3
5.250000 2
5.266667 2
5.300000 1
5.316667 2
5.333333 3
5.350000 2
5.383333 5
5.400000 3
5.416667 1
5.450000 1
5.483333 1
5.516667 1
5.533333 2
5.550000 1
5.566667 2
5.583333 1
5.633333 2
5.683333 2
5.700000 1
5.716667 1
5.733333 2
5.766667 2
5.816667 1
5.866667 1
5.883333 1
5.916667 2
5.983333 2
6.033333 1
6.050000 2
6.133333 1
6.166667 1
6.200000 1
6.216667 1
6.433333 1
6.533333 1
6.600000 1
7.000000 1
NA 68
ggplot(data = InputData, mapping = aes(x = hsc_mean_T2, fill = factor(hsc_mean_T2))) + 
  geom_histogram(binwidth = 0.3) + guides(fill = "none") #視覚化

2-1-3. 精神的健康の度数分布

#health1_T1の度数分布
health1_T1_count <- dplyr::count(InputData, health1_T1)
knitr::kable(health1_T1_count) #テーブル化
health1_T1 n
1 12
2 75
3 97
4 135
5 72
6 21
ggplot(data = InputData, mapping = aes(x = health1_T1, fill = factor(health1_T1))) + geom_histogram(binwidth = 1) #視覚化

#health2_T1の度数分布
health2_T1_count <- dplyr::count(InputData, health2_T1)
knitr::kable(health2_T1_count) #テーブル化
health2_T1 n
1 11
2 73
3 108
4 126
5 72
6 22
ggplot(data = InputData, mapping = aes(x = health2_T1, fill = factor(health2_T1))) + geom_histogram(binwidth = 1) #視覚化

#health3_T1の度数分布
health3_T1_count <- dplyr::count(InputData, health3_T1)
knitr::kable(health3_T1_count) #テーブル化
health3_T1 n
1 10
2 83
3 97
4 141
5 63
6 18
ggplot(data = InputData, mapping = aes(x = health3_T1, fill = factor(health3_T1))) + geom_histogram(binwidth = 1) #視覚化

#health4_T1の度数分布
health4_T1_count <- dplyr::count(InputData, health4_T1)
knitr::kable(health4_T1_count) #テーブル化
health4_T1 n
1 16
2 90
3 115
4 98
5 69
6 24
ggplot(data = InputData, mapping = aes(x = health4_T1, fill = factor(health4_T1))) + geom_histogram(binwidth = 1) #視覚化

#health5_T1の度数分布
health5_T1_count <- dplyr::count(InputData, health5_T1)
knitr::kable(health5_T1_count) #テーブル化
health5_T1 n
1 18
2 93
3 123
4 113
5 50
6 15
ggplot(data = InputData, mapping = aes(x = health5_T1, fill = factor(health5_T1))) + geom_histogram(binwidth = 1) #視覚化

#health_mean_T1の度数分布
health_mean_T1_count <- dplyr::count(InputData, health_mean_T1)
knitr::kable(health_mean_T1_count) #テーブル化
health_mean_T1 n
1.0 4
1.2 3
1.4 1
1.6 3
1.8 5
2.0 25
2.2 16
2.4 16
2.6 17
2.8 20
3.0 40
3.2 35
3.4 26
3.6 26
3.8 35
4.0 33
4.2 18
4.4 14
4.6 10
4.8 16
5.0 24
5.2 9
5.4 4
5.6 4
5.8 2
6.0 6
ggplot(data = InputData, mapping = aes(x = health_mean_T1, fill = factor(health_mean_T1))) + geom_histogram(binwidth = 0.2) #視覚化

#health1_T2の度数分布
health1_T2_count <- dplyr::count(InputData, health1_T2)
knitr::kable(health1_T2_count) #テーブル化
health1_T2 n
1 5
2 22
3 58
4 147
5 86
6 26
NA 68
ggplot(data = InputData, mapping = aes(x = health1_T2, fill = factor(health1_T2))) + geom_histogram(binwidth = 1) #視覚化

#health2_T2の度数分布
health2_T2_count <- dplyr::count(InputData, health2_T2)
knitr::kable(health2_T2_count) #テーブル化
health2_T2 n
1 7
2 30
3 61
4 159
5 71
6 16
NA 68
ggplot(data = InputData, mapping = aes(x = health2_T2, fill = factor(health2_T2))) + geom_histogram(binwidth = 1) #視覚化

#health3_T2の度数分布
health3_T2_count <- dplyr::count(InputData, health3_T2)
knitr::kable(health3_T2_count) #テーブル化
health3_T2 n
1 4
2 33
3 68
4 150
5 67
6 22
NA 68
ggplot(data = InputData, mapping = aes(x = health3_T2, fill = factor(health3_T2))) + geom_histogram(binwidth = 1) #視覚化

#health4_T2の度数分布
health4_T2_count <- dplyr::count(InputData, health4_T2)
knitr::kable(health4_T2_count) #テーブル化
health4_T2 n
1 8
2 56
3 84
4 104
5 76
6 16
NA 68
ggplot(data = InputData, mapping = aes(x = health4_T2, fill = factor(health4_T2))) + geom_histogram(binwidth = 1) #視覚化

#health5_T2の度数分布
health5_T2_count <- dplyr::count(InputData, health5_T2)
knitr::kable(health5_T2_count) #テーブル化
health5_T2 n
1 7
2 42
3 70
4 126
5 74
6 25
NA 68
ggplot(data = InputData, mapping = aes(x = health5_T2, fill = factor(health5_T2))) + geom_histogram(binwidth = 1) #視覚化

#health_mean_T2の度数分布
health_mean_T2_count <- dplyr::count(InputData, health_mean_T2)
knitr::kable(health_mean_T2_count) #テーブル化
health_mean_T2 n
1.0 3
1.4 1
1.8 5
2.0 7
2.2 5
2.4 10
2.6 7
2.8 11
3.0 17
3.2 15
3.4 20
3.6 26
3.8 36
4.0 56
4.2 25
4.4 18
4.6 15
4.8 13
5.0 29
5.2 11
5.4 2
5.6 2
5.8 3
6.0 7
NA 68
ggplot(data = InputData, mapping = aes(x = health_mean_T2, fill = factor(health_mean_T2))) + geom_histogram(binwidth = 0.2) #視覚化

2-1-4. PANASの度数分布

#panas1_T1の度数分布
panas1_T1_count <- dplyr::count(InputData, panas1_T1)
knitr::kable(panas1_T1_count) #テーブル化
panas1_T1 n
1 89
2 134
3 117
4 52
5 17
6 3
ggplot(data = InputData, mapping = aes(x = panas1_T1, fill = factor(panas1_T1))) + geom_histogram(binwidth = 1) #視覚化

#panas2_T1の度数分布
panas2_T1_count <- dplyr::count(InputData, panas2_T1)
knitr::kable(panas2_T1_count) #テーブル化
panas2_T1 n
1 8
2 35
3 112
4 165
5 87
6 5
ggplot(data = InputData, mapping = aes(x = panas2_T1, fill = factor(panas2_T1))) + geom_histogram(binwidth = 1) #視覚化

#panas3_T1の度数分布
panas3_T1_count <- dplyr::count(InputData, panas3_T1)
knitr::kable(panas3_T1_count) #テーブル化
panas3_T1 n
1 106
2 136
3 122
4 38
5 8
6 2
ggplot(data = InputData, mapping = aes(x = panas3_T1, fill = factor(panas3_T1))) + geom_histogram(binwidth = 1) #視覚化

#panas4_T1の度数分布
panas4_T1_count <- dplyr::count(InputData, panas4_T1)
knitr::kable(panas4_T1_count) #テーブル化
panas4_T1 n
1 22
2 57
3 172
4 122
5 35
6 4
ggplot(data = InputData, mapping = aes(x = panas4_T1, fill = factor(panas4_T1))) + geom_histogram(binwidth = 1) #視覚化

#panas5_T1の度数分布
panas5_T1_count <- dplyr::count(InputData, panas5_T1)
knitr::kable(panas5_T1_count) #テーブル化
panas5_T1 n
1 68
2 123
3 161
4 44
5 11
6 5
ggplot(data = InputData, mapping = aes(x = panas5_T1, fill = factor(panas5_T1))) + geom_histogram(binwidth = 1) #視覚化

#panas6_T1の度数分布
panas6_T1_count <- dplyr::count(InputData, panas6_T1)
knitr::kable(panas6_T1_count) #テーブル化
panas6_T1 n
1 20
2 70
3 168
4 112
5 37
6 5
ggplot(data = InputData, mapping = aes(x = panas6_T1, fill = factor(panas6_T1))) + geom_histogram(binwidth = 1) #視覚化

#panas7_T1の度数分布
panas7_T1_count <- dplyr::count(InputData, panas7_T1)
knitr::kable(panas7_T1_count) #テーブル化
panas7_T1 n
1 20
2 54
3 138
4 134
5 56
6 10
ggplot(data = InputData, mapping = aes(x = panas7_T1, fill = factor(panas7_T1))) + geom_histogram(binwidth = 1) #視覚化

#panas8_T1の度数分布
panas8_T1_count <- dplyr::count(InputData, panas8_T1)
knitr::kable(panas8_T1_count) #テーブル化
panas8_T1 n
1 10
2 36
3 135
4 157
5 57
6 17
ggplot(data = InputData, mapping = aes(x = panas8_T1, fill = factor(panas8_T1))) + geom_histogram(binwidth = 1) #視覚化

#panas9_T1の度数分布
panas9_T1_count <- dplyr::count(InputData, panas9_T1)
knitr::kable(panas9_T1_count) #テーブル化
panas9_T1 n
1 31
2 88
3 137
4 106
5 37
6 13
ggplot(data = InputData, mapping = aes(x = panas9_T1, fill = factor(panas9_T1))) + geom_histogram(binwidth = 1) #視覚化

#panas10_T1の度数分布
panas10_T1_count <- dplyr::count(InputData, panas10_T1)
knitr::kable(panas10_T1_count) #テーブル化
panas10_T1 n
1 19
2 53
3 175
4 128
5 32
6 5
ggplot(data = InputData, mapping = aes(x = panas10_T1, fill = factor(panas10_T1))) + geom_histogram(binwidth = 1) #視覚化

#panas11_T1の度数分布
panas11_T1_count <- dplyr::count(InputData, panas11_T1)
knitr::kable(panas11_T1_count) #テーブル化
panas11_T1 n
1 36
2 79
3 152
4 95
5 39
6 11
ggplot(data = InputData, mapping = aes(x = panas11_T1, fill = factor(panas11_T1))) + geom_histogram(binwidth = 1) #視覚化

#panas12_T1の度数分布
panas12_T1_count <- dplyr::count(InputData, panas12_T1)
knitr::kable(panas12_T1_count) #テーブル化
panas12_T1 n
1 16
2 54
3 128
4 138
5 62
6 14
ggplot(data = InputData, mapping = aes(x = panas12_T1, fill = factor(panas12_T1))) + geom_histogram(binwidth = 1) #視覚化

#panas13_T1の度数分布
panas13_T1_count <- dplyr::count(InputData, panas13_T1)
knitr::kable(panas13_T1_count) #テーブル化
panas13_T1 n
1 69
2 122
3 163
4 44
5 10
6 4
ggplot(data = InputData, mapping = aes(x = panas13_T1, fill = factor(panas13_T1))) + geom_histogram(binwidth = 1) #視覚化

#panas14_T1の度数分布
panas14_T1_count <- dplyr::count(InputData, panas14_T1)
knitr::kable(panas14_T1_count) #テーブル化
panas14_T1 n
1 28
2 88
3 209
4 67
5 18
6 2
ggplot(data = InputData, mapping = aes(x = panas14_T1, fill = factor(panas14_T1))) + geom_histogram(binwidth = 1) #視覚化

#panas15_T1の度数分布
panas15_T1_count <- dplyr::count(InputData, panas15_T1)
knitr::kable(panas15_T1_count) #テーブル化
panas15_T1 n
1 25
2 68
3 142
4 118
5 49
6 10
ggplot(data = InputData, mapping = aes(x = panas15_T1, fill = factor(panas15_T1))) + geom_histogram(binwidth = 1) #視覚化

#panas16_T1の度数分布
panas16_T1_count <- dplyr::count(InputData, panas16_T1)
knitr::kable(panas16_T1_count) #テーブル化
panas16_T1 n
1 48
2 104
3 167
4 69
5 19
6 5
ggplot(data = InputData, mapping = aes(x = panas16_T1, fill = factor(panas16_T1))) + geom_histogram(binwidth = 1) #視覚化

#positive_T1の度数分布
positive_T1_count <- dplyr::count(InputData, positive_mean_T1)
knitr::kable(positive_T1_count) #テーブル化
positive_mean_T1 n
1.000 2
1.125 1
1.500 2
1.625 3
1.875 4
2.000 7
2.125 4
2.250 12
2.375 7
2.500 11
2.625 16
2.750 17
2.875 26
3.000 36
3.125 40
3.250 32
3.375 21
3.500 26
3.625 26
3.750 26
3.875 20
4.000 15
4.125 16
4.250 14
4.375 10
4.500 6
4.625 3
4.750 3
4.875 2
5.000 1
5.250 2
5.625 1
ggplot(data = InputData, mapping = aes(x = positive_mean_T1, fill = factor(positive_mean_T1))) + geom_histogram(binwidth = 0.3) #視覚化

#negative_T1の度数分布
negative_T1_count <- dplyr::count(InputData, negative_mean_T1)
knitr::kable(negative_T1_count) #テーブル化
negative_mean_T1 n
1.000 9
1.125 2
1.250 3
1.375 3
1.500 5
1.625 5
1.750 6
1.875 11
2.000 22
2.125 14
2.250 22
2.375 15
2.500 17
2.625 30
2.750 18
2.875 27
3.000 35
3.125 38
3.250 24
3.375 18
3.500 19
3.625 20
3.750 10
3.875 1
4.000 9
4.125 5
4.250 8
4.375 5
4.500 2
4.625 2
4.750 2
4.875 2
5.000 1
5.125 1
5.750 1
ggplot(data = InputData, mapping = aes(x = negative_mean_T1, fill = factor(negative_mean_T1))) + geom_histogram(binwidth = 0.2) #視覚化

2-1-5. 学校環境変化の度数分布

#environment1_T2の度数分布
environment1_T2_count <- dplyr::count(InputData, environment1_T2)
knitr::kable(environment1_T2_count) #テーブル化
environment1_T2 n
1 2
2 3
3 27
4 105
5 115
6 50
7 42
NA 68
ggplot(data = InputData, mapping = aes(x = environment1_T2, fill = factor(environment1_T2))) + geom_histogram(binwidth = 1) #視覚化

#environment2_T2の度数分布
environment2_T2_count <- dplyr::count(InputData, environment2_T2)
knitr::kable(environment2_T2_count) #テーブル化
environment2_T2 n
1 1
2 5
3 37
4 119
5 99
6 49
7 34
NA 68
ggplot(data = InputData, mapping = aes(x = environment2_T2, fill = factor(environment2_T2))) + geom_histogram(binwidth = 1) #視覚化

#environment3_T2の度数分布
environment3_T2_count <- dplyr::count(InputData, environment3_T2)
knitr::kable(environment3_T2_count) #テーブル化
environment3_T2 n
1 3
2 5
3 36
4 107
5 96
6 66
7 31
NA 68
ggplot(data = InputData, mapping = aes(x = environment3_T2, fill = factor(environment3_T2))) + geom_histogram(binwidth = 1) #視覚化

#environment4_T2の度数分布
environment4_T2_count <- dplyr::count(InputData, environment4_T2)
knitr::kable(environment4_T2_count) #テーブル化
environment4_T2 n
1 2
2 4
3 36
4 143
5 98
6 41
7 20
NA 68
ggplot(data = InputData, mapping = aes(x = environment4_T2, fill = factor(environment4_T2))) + geom_histogram(binwidth = 1) #視覚化

#environment5_T2の度数分布
environment5_T2_count <- dplyr::count(InputData, environment5_T2)
knitr::kable(environment5_T2_count) #テーブル化
environment5_T2 n
1 4
2 8
3 31
4 182
5 71
6 35
7 13
NA 68
ggplot(data = InputData, mapping = aes(x = environment5_T2, fill = factor(environment5_T2))) + geom_histogram(binwidth = 1) #視覚化

#environment6_T2の度数分布
environment6_T2_count <- dplyr::count(InputData, environment6_T2)
knitr::kable(environment6_T2_count) #テーブル化
environment6_T2 n
1 1
2 6
3 35
4 151
5 75
6 48
7 28
NA 68
ggplot(data = InputData, mapping = aes(x = environment6_T2, fill = factor(environment6_T2))) + geom_histogram(binwidth = 1) #視覚化

#environment7_T2の度数分布
environment7_T2_count <- dplyr::count(InputData, environment7_T2)
knitr::kable(environment7_T2_count) #テーブル化
environment7_T2 n
1 12
2 22
3 70
4 118
5 78
6 31
7 13
NA 68
ggplot(data = InputData, mapping = aes(x = environment7_T2, fill = factor(environment7_T2))) + geom_histogram(binwidth = 1) #視覚化

#environment8_T2の度数分布
environment8_T2_count <- dplyr::count(InputData, environment8_T2)
knitr::kable(environment8_T2_count) #テーブル化
environment8_T2 n
1 13
2 34
3 81
4 103
5 63
6 38
7 12
NA 68
ggplot(data = InputData, mapping = aes(x = environment8_T2, fill = factor(environment8_T2))) + geom_histogram(binwidth = 1) #視覚化

#environment9_T2の度数分布
environment9_T2_count <- dplyr::count(InputData, environment9_T2)
knitr::kable(environment9_T2_count) #テーブル化
environment9_T2 n
1 44
2 62
3 105
4 59
5 29
6 23
7 22
NA 68
ggplot(data = InputData, mapping = aes(x = environment9_T2, fill = factor(environment9_T2))) + geom_histogram(binwidth = 1) #視覚化

#environment10_T2の度数分布
environment10_T2_count <- dplyr::count(InputData, environment10_T2)
knitr::kable(environment10_T2_count) #テーブル化
environment10_T2 n
1 28
2 56
3 102
4 67
5 40
6 26
7 25
NA 68
ggplot(data = InputData, mapping = aes(x = environment10_T2, fill = factor(environment10_T2))) + geom_histogram(binwidth = 1) #視覚化

#environment11_T2の度数分布
environment11_T2_count <- dplyr::count(InputData, environment11_T2)
knitr::kable(environment11_T2_count) #テーブル化
environment11_T2 n
1 8
2 17
3 40
4 128
5 83
6 40
7 28
NA 68
ggplot(data = InputData, mapping = aes(x = environment11_T2, fill = factor(environment11_T2))) + geom_histogram(binwidth = 1) #視覚化

#environment11_T2の度数分布
environment_mean_T2_count <- dplyr::count(InputData, environment_mean_T2)
knitr::kable(environment_mean_T2_count) #テーブル化
environment_mean_T2 n
1.000000 1
1.363636 1
2.272727 1
2.545454 1
2.636364 1
2.818182 5
2.909091 1
3.000000 4
3.090909 3
3.181818 6
3.272727 4
3.363636 11
3.454546 7
3.545454 6
3.636364 8
3.727273 13
3.818182 22
3.909091 21
4.000000 25
4.090909 17
4.181818 21
4.272727 21
4.363636 13
4.454546 13
4.545454 13
4.636364 10
4.727273 12
4.818182 9
4.909091 9
5.000000 9
5.090909 1
5.181818 4
5.272727 8
5.363636 8
5.454546 2
5.545454 5
5.636364 6
5.727273 2
5.818182 4
5.909091 3
6.000000 1
6.090909 2
6.181818 3
6.272727 5
6.545454 1
7.000000 1
NA 68
ggplot(data = InputData, mapping = aes(x = environment_mean_T2, fill = factor(environment_mean_T2))) + 
  geom_histogram(binwidth = 0.2) +
  guides(fill = "none")#視覚化

2-1-6. BISの度数分布

#bis1_T2の度数分布
bis1_T2_count <- dplyr::count(InputData, bis1_T2)
knitr::kable(bis1_T2_count) #テーブル化
bis1_T2 n
1 18
2 137
3 158
4 31
NA 68
ggplot(data = InputData, mapping = aes(x = bis1_T2, fill = factor(bis1_T2))) + geom_histogram(binwidth = 1) #視覚化

#bis2_T2の度数分布
bis2_T2_count <- dplyr::count(InputData, bis2_T2)
knitr::kable(bis2_T2_count) #テーブル化
bis2_T2 n
1 8
2 81
3 175
4 80
NA 68
ggplot(data = InputData, mapping = aes(x = bis2_T2, fill = factor(bis2_T2))) + geom_histogram(binwidth = 1) #視覚化

#bis3_T2の度数分布
bis3_T2_count <- dplyr::count(InputData, bis3_T2)
knitr::kable(bis3_T2_count) #テーブル化
bis3_T2 n
1 13
2 122
3 174
4 35
NA 68
ggplot(data = InputData, mapping = aes(x = bis3_T2, fill = factor(bis3_T2))) + geom_histogram(binwidth = 1) #視覚化

#bis4_T2の度数分布
bis4_T2_count <- dplyr::count(InputData, bis4_T2)
knitr::kable(bis4_T2_count) #テーブル化
bis4_T2 n
1 18
2 157
3 145
4 24
NA 68
ggplot(data = InputData, mapping = aes(x = bis4_T2, fill = factor(bis4_T2))) + geom_histogram(binwidth = 1) #視覚化

#bis5_T2の度数分布
bis5_T2_count <- dplyr::count(InputData, bis5_T2)
knitr::kable(bis5_T2_count) #テーブル化
bis5_T2 n
1 6
2 127
3 181
4 30
NA 68
ggplot(data = InputData, mapping = aes(x = bis5_T2, fill = factor(bis5_T2))) + geom_histogram(binwidth = 1) #視覚化

#bis6_T2の度数分布
bis6_T2_count <- dplyr::count(InputData, bis6_T2)
knitr::kable(bis6_T2_count) #テーブル化
bis6_T2 n
1 20
2 166
3 136
4 22
NA 68
ggplot(data = InputData, mapping = aes(x = bis6_T2, fill = factor(bis6_T2))) + geom_histogram(binwidth = 1) #視覚化

#bis7_T2の度数分布
bis7_T2_count <- dplyr::count(InputData, bis7_T2)
knitr::kable(bis7_T2_count) #テーブル化
bis7_T2 n
1 35
2 170
3 120
4 19
NA 68
ggplot(data = InputData, mapping = aes(x = bis7_T2, fill = factor(bis7_T2))) + geom_histogram(binwidth = 1) #視覚化

#bis_mean_T2の度数分布
bis_mean_T2_count <- dplyr::count(InputData, bis_mean_T2)
knitr::kable(bis_mean_T2_count) #テーブル化
bis_mean_T2 n
1.000000 1
1.428571 1
1.571429 3
1.714286 4
1.857143 9
2.000000 19
2.142857 27
2.285714 36
2.428571 36
2.571429 58
2.714286 50
2.857143 34
3.000000 18
3.142857 17
3.285714 8
3.428571 4
3.571429 10
3.714286 5
3.857143 3
4.000000 1
NA 68
ggplot(data = InputData, mapping = aes(x = bis_mean_T2, fill = factor(bis_mean_T2))) + 
  geom_histogram(binwidth = 0.1) + 
  guides(fill = "none") #視覚化

2-1-7. BASの度数分布

#bas1_T2の度数分布
bas1_T2_count <- dplyr::count(InputData, bas1_T2)
knitr::kable(bas1_T2_count) #テーブル化
bas1_T2 n
1 7
2 138
3 161
4 38
NA 68
ggplot(data = InputData, mapping = aes(x = bas1_T2, fill = factor(bas1_T2))) + geom_histogram(binwidth = 1) #視覚化

#bas2_T2の度数分布
bas2_T2_count <- dplyr::count(InputData, bas2_T2)
knitr::kable(bas2_T2_count) #テーブル化
bas2_T2 n
2 45
3 193
4 106
NA 68
ggplot(data = InputData, mapping = aes(x = bas2_T2, fill = factor(bas2_T2))) + geom_histogram(binwidth = 1) #視覚化

#bas3_T2の度数分布
bas3_T2_count <- dplyr::count(InputData, bas3_T2)
knitr::kable(bas3_T2_count) #テーブル化
bas3_T2 n
1 5
2 81
3 207
4 51
NA 68
ggplot(data = InputData, mapping = aes(x = bas3_T2, fill = factor(bas3_T2))) + geom_histogram(binwidth = 1) #視覚化

#bas4_T2の度数分布
bas4_T2_count <- dplyr::count(InputData, bas4_T2)
knitr::kable(bas4_T2_count) #テーブル化
bas4_T2 n
1 2
2 60
3 212
4 70
NA 68
ggplot(data = InputData, mapping = aes(x = bas4_T2, fill = factor(bas4_T2))) + geom_histogram(binwidth = 1) #視覚化

#bas5_T2の度数分布
bas5_T2_count <- dplyr::count(InputData, bas5_T2)
knitr::kable(bas5_T2_count) #テーブル化
bas5_T2 n
1 8
2 142
3 161
4 33
NA 68
ggplot(data = InputData, mapping = aes(x = bas5_T2, fill = factor(bas5_T2))) + geom_histogram(binwidth = 1) #視覚化

#bas6_T2の度数分布
bas6_T2_count <- dplyr::count(InputData, bas6_T2)
knitr::kable(bas6_T2_count) #テーブル化
bas6_T2 n
1 17
2 121
3 186
4 20
NA 68
ggplot(data = InputData, mapping = aes(x = bas6_T2, fill = factor(bas6_T2))) + geom_histogram(binwidth = 1) #視覚化

#bas7_T2の度数分布
bas7_T2_count <- dplyr::count(InputData, bas7_T2)
knitr::kable(bas7_T2_count) #テーブル化
bas7_T2 n
1 11
2 128
3 178
4 27
NA 68
ggplot(data = InputData, mapping = aes(x = bas7_T2, fill = factor(bas7_T2))) + geom_histogram(binwidth = 1) #視覚化

#bas8_T2の度数分布
bas8_T2_count <- dplyr::count(InputData, bas8_T2)
knitr::kable(bas8_T2_count) #テーブル化
bas8_T2 n
1 5
2 118
3 190
4 31
NA 68
ggplot(data = InputData, mapping = aes(x = bas8_T2, fill = factor(bas8_T2))) + geom_histogram(binwidth = 1) #視覚化

#bas9_T2の度数分布
bas9_T2_count <- dplyr::count(InputData, bas9_T2)
knitr::kable(bas9_T2_count) #テーブル化
bas9_T2 n
1 24
2 181
3 133
4 6
NA 68
ggplot(data = InputData, mapping = aes(x = bas9_T2, fill = factor(bas9_T2))) + geom_histogram(binwidth = 1) #視覚化

#bas10_T2の度数分布
bas10_T2_count <- dplyr::count(InputData, bas10_T2)
knitr::kable(bas10_T2_count) #テーブル化
bas10_T2 n
1 8
2 100
3 201
4 35
NA 68
ggplot(data = InputData, mapping = aes(x = bas10_T2, fill = factor(bas10_T2))) + geom_histogram(binwidth = 1) #視覚化

#bas11_T2の度数分布
bas11_T2_count <- dplyr::count(InputData, bas11_T2)
knitr::kable(bas11_T2_count) #テーブル化
bas11_T2 n
1 23
2 191
3 118
4 12
NA 68
ggplot(data = InputData, mapping = aes(x = bas11_T2, fill = factor(bas11_T2))) + geom_histogram(binwidth = 1) #視覚化

#bas12_T2の度数分布
bas12_T2_count <- dplyr::count(InputData, bas12_T2)
knitr::kable(bas12_T2_count) #テーブル化
bas12_T2 n
1 14
2 145
3 158
4 27
NA 68
ggplot(data = InputData, mapping = aes(x = bas12_T2, fill = factor(bas12_T2))) + geom_histogram(binwidth = 1) #視覚化

#bas13_T2の度数分布
bas13_T2_count <- dplyr::count(InputData, bas13_T2)
knitr::kable(bas13_T2_count) #テーブル化
bas13_T2 n
1 10
2 104
3 194
4 36
NA 68
ggplot(data = InputData, mapping = aes(x = bas13_T2, fill = factor(bas13_T2))) + geom_histogram(binwidth = 1) #視覚化

#bas_mean_T2の度数分布
bas_mean_T2_count <- dplyr::count(InputData, bas_mean_T2)
knitr::kable(bas_mean_T2_count) #テーブル化
bas_mean_T2 n
2.857143 1
3.000000 1
3.142857 1
3.428571 1
3.571429 3
3.714286 6
3.857143 6
4.000000 14
4.142857 12
4.285714 18
4.428571 17
4.571429 30
4.714286 18
4.857143 18
5.000000 26
5.142857 33
5.285714 25
5.428571 32
5.571429 24
5.714286 18
5.857143 7
6.000000 11
6.142857 8
6.285714 2
6.428571 5
6.571429 3
6.857143 2
7.000000 2
NA 68
ggplot(data = InputData, mapping = aes(x = bas_mean_T2, fill = factor(bas_mean_T2))) + 
  geom_histogram(binwidth = 0.2) + 
  guides(fill = "none") #視覚化

2-2. 全変数の記述統計量

summary(InputData) #一気に出力(SDは出力されない)
##        ID           gardian_gender_T1 gardian_age_T1  prefecture_T1  
##  Min.   :    8339   Min.   :0.000     Min.   :32.00   Min.   : 1.00  
##  1st Qu.: 3547768   1st Qu.:0.000     1st Qu.:43.00   1st Qu.:13.00  
##  Median : 7551488   Median :1.000     Median :46.00   Median :23.00  
##  Mean   : 8262284   Mean   :0.551     Mean   :46.24   Mean   :22.02  
##  3rd Qu.:13230564   3rd Qu.:1.000     3rd Qu.:49.00   3rd Qu.:28.00  
##  Max.   :16625273   Max.   :1.000     Max.   :59.00   Max.   :47.00  
##                                                                      
##     area_T1        married_T1    familyincome_T1   pinincome_T1   
##  Min.   :1.000   Min.   :1.000   Min.   : 1.000   Min.   : 1.000  
##  1st Qu.:3.000   1st Qu.:2.000   1st Qu.: 3.000   1st Qu.: 1.000  
##  Median :4.000   Median :2.000   Median : 4.000   Median : 2.000  
##  Mean   :4.403   Mean   :1.942   Mean   : 3.952   Mean   : 2.451  
##  3rd Qu.:5.000   3rd Qu.:2.000   3rd Qu.: 5.000   3rd Qu.: 3.000  
##  Max.   :8.000   Max.   :2.000   Max.   :10.000   Max.   :10.000  
##                                  NA's   :56       NA's   :55      
##      job_T1       child_gender_T1    hsc1_T1         hsc2_T1     
##  Min.   : 1.000   Min.   :0.0     Min.   :1.000   Min.   :1.000  
##  1st Qu.: 4.000   1st Qu.:0.0     1st Qu.:4.000   1st Qu.:3.000  
##  Median : 6.000   Median :0.5     Median :4.000   Median :4.000  
##  Mean   : 6.221   Mean   :0.5     Mean   :4.243   Mean   :4.148  
##  3rd Qu.: 8.000   3rd Qu.:1.0     3rd Qu.:5.000   3rd Qu.:5.000  
##  Max.   :12.000   Max.   :1.0     Max.   :7.000   Max.   :7.000  
##                                                                  
##     hsc3_T1         hsc4_T1         hsc5_T1         hsc6_T1     
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:4.000   1st Qu.:3.000   1st Qu.:4.000   1st Qu.:4.000  
##  Median :5.000   Median :4.000   Median :5.000   Median :5.000  
##  Mean   :4.692   Mean   :4.167   Mean   :5.206   Mean   :4.816  
##  3rd Qu.:6.000   3rd Qu.:5.000   3rd Qu.:6.000   3rd Qu.:6.000  
##  Max.   :7.000   Max.   :7.000   Max.   :7.000   Max.   :7.000  
##                                                                 
##     hsc7_T1         hsc8_T1         hsc9_T1         hsc10_T1    
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:4.000   1st Qu.:4.000   1st Qu.:3.000   1st Qu.:5.000  
##  Median :5.000   Median :4.000   Median :4.000   Median :6.000  
##  Mean   :4.769   Mean   :4.398   Mean   :4.138   Mean   :5.614  
##  3rd Qu.:6.000   3rd Qu.:5.000   3rd Qu.:5.000   3rd Qu.:7.000  
##  Max.   :7.000   Max.   :7.000   Max.   :7.000   Max.   :7.000  
##                                                                 
##     hsc11_T1        hsc12_T1       health1_T1     health2_T1   
##  Min.   :1.000   Min.   :1.000   Min.   :1.00   Min.   :1.000  
##  1st Qu.:4.000   1st Qu.:4.000   1st Qu.:3.00   1st Qu.:3.000  
##  Median :4.000   Median :5.000   Median :4.00   Median :4.000  
##  Mean   :4.617   Mean   :4.575   Mean   :3.59   Mean   :3.585  
##  3rd Qu.:6.000   3rd Qu.:5.000   3rd Qu.:4.00   3rd Qu.:4.000  
##  Max.   :7.000   Max.   :7.000   Max.   :6.00   Max.   :6.000  
##                                                                
##    health3_T1      health4_T1      health5_T1      panas1_T1    
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:3.000   1st Qu.:2.000   1st Qu.:2.000   1st Qu.:2.000  
##  Median :4.000   Median :3.000   Median :3.000   Median :2.000  
##  Mean   :3.529   Mean   :3.451   Mean   :3.313   Mean   :2.473  
##  3rd Qu.:4.000   3rd Qu.:4.000   3rd Qu.:4.000   3rd Qu.:3.000  
##  Max.   :6.000   Max.   :6.000   Max.   :6.000   Max.   :6.000  
##                                                                 
##    panas2_T1       panas3_T1       panas4_T1      panas5_T1    
##  Min.   :1.000   Min.   :1.000   Min.   :1.00   Min.   :1.000  
##  1st Qu.:3.000   1st Qu.:1.000   1st Qu.:3.00   1st Qu.:2.000  
##  Median :4.000   Median :2.000   Median :3.00   Median :3.000  
##  Mean   :3.735   Mean   :2.301   Mean   :3.25   Mean   :2.568  
##  3rd Qu.:4.000   3rd Qu.:3.000   3rd Qu.:4.00   3rd Qu.:3.000  
##  Max.   :6.000   Max.   :6.000   Max.   :6.00   Max.   :6.000  
##                                                                
##    panas6_T1       panas7_T1       panas8_T1       panas9_T1    
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:3.000   1st Qu.:3.000   1st Qu.:3.000   1st Qu.:2.000  
##  Median :3.000   Median :3.000   Median :4.000   Median :3.000  
##  Mean   :3.221   Mean   :3.442   Mean   :3.646   Mean   :3.167  
##  3rd Qu.:4.000   3rd Qu.:4.000   3rd Qu.:4.000   3rd Qu.:4.000  
##  Max.   :6.000   Max.   :6.000   Max.   :6.000   Max.   :6.000  
##                                                                 
##    panas10_T1      panas11_T1      panas12_T1      panas13_T1   
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:3.000   1st Qu.:2.000   1st Qu.:3.000   1st Qu.:2.000  
##  Median :3.000   Median :3.000   Median :4.000   Median :3.000  
##  Mean   :3.282   Mean   :3.133   Mean   :3.529   Mean   :2.553  
##  3rd Qu.:4.000   3rd Qu.:4.000   3rd Qu.:4.000   3rd Qu.:3.000  
##  Max.   :6.000   Max.   :6.000   Max.   :6.000   Max.   :6.000  
##                                                                 
##    panas14_T1      panas15_T1      panas16_T1    gardian_gender_T2
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :0.0000   
##  1st Qu.:2.000   1st Qu.:3.000   1st Qu.:2.000   1st Qu.:0.0000   
##  Median :3.000   Median :3.000   Median :3.000   Median :1.0000   
##  Mean   :2.915   Mean   :3.311   Mean   :2.811   Mean   :0.5291   
##  3rd Qu.:3.000   3rd Qu.:4.000   3rd Qu.:3.000   3rd Qu.:1.0000   
##  Max.   :6.000   Max.   :6.000   Max.   :6.000   Max.   :1.0000   
##                                                  NA's   :68       
##  gardian_age_T2 prefecture_T2      area_T2        married_T2   
##  Min.   :32.0   Min.   : 1.00   Min.   :1.000   Min.   :1.000  
##  1st Qu.:43.0   1st Qu.:13.00   1st Qu.:3.000   1st Qu.:2.000  
##  Median :46.0   Median :23.00   Median :4.000   Median :2.000  
##  Mean   :46.4   Mean   :22.02   Mean   :4.395   Mean   :1.942  
##  3rd Qu.:50.0   3rd Qu.:28.00   3rd Qu.:5.000   3rd Qu.:2.000  
##  Max.   :59.0   Max.   :47.00   Max.   :8.000   Max.   :2.000  
##  NA's   :68     NA's   :68      NA's   :68      NA's   :68     
##  familyincome_T2   pinincome_T2       job_T2       child_gender_T2 
##  Min.   : 1.000   Min.   : 1.00   Min.   : 1.000   Min.   :0.0000  
##  1st Qu.: 3.000   1st Qu.: 1.00   1st Qu.: 4.000   1st Qu.:0.0000  
##  Median : 4.000   Median : 2.00   Median : 6.000   Median :0.0000  
##  Mean   : 4.057   Mean   : 2.58   Mean   : 6.113   Mean   :0.4942  
##  3rd Qu.: 5.000   3rd Qu.: 3.00   3rd Qu.: 8.000   3rd Qu.:1.0000  
##  Max.   :10.000   Max.   :10.00   Max.   :12.000   Max.   :1.0000  
##  NA's   :112      NA's   :112     NA's   :68       NA's   :68      
##  environment1_T2 environment2_T2 environment3_T2 environment4_T2
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:4.000   1st Qu.:4.000   1st Qu.:4.000   1st Qu.:4.000  
##  Median :5.000   Median :5.000   Median :5.000   Median :4.000  
##  Mean   :4.878   Mean   :4.724   Mean   :4.773   Mean   :4.552  
##  3rd Qu.:6.000   3rd Qu.:5.000   3rd Qu.:6.000   3rd Qu.:5.000  
##  Max.   :7.000   Max.   :7.000   Max.   :7.000   Max.   :7.000  
##  NA's   :68      NA's   :68      NA's   :68      NA's   :68     
##  environment5_T2 environment6_T2 environment7_T2 environment8_T2
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:4.000   1st Qu.:4.000   1st Qu.:3.000   1st Qu.:3.000  
##  Median :4.000   Median :4.000   Median :4.000   Median :4.000  
##  Mean   :4.352   Mean   :4.596   Mean   :4.084   Mean   :3.962  
##  3rd Qu.:5.000   3rd Qu.:5.000   3rd Qu.:5.000   3rd Qu.:5.000  
##  Max.   :7.000   Max.   :7.000   Max.   :7.000   Max.   :7.000  
##  NA's   :68      NA's   :68      NA's   :68      NA's   :68     
##  environment9_T2 environment10_T2 environment11_T2    hsc1_T2    
##  Min.   :1.00    Min.   :1.000    Min.   :1.000    Min.   :1.00  
##  1st Qu.:2.00    1st Qu.:3.000    1st Qu.:4.000    1st Qu.:4.00  
##  Median :3.00    Median :3.000    Median :4.000    Median :4.00  
##  Mean   :3.36    Mean   :3.619    Mean   :4.433    Mean   :4.18  
##  3rd Qu.:4.00    3rd Qu.:5.000    3rd Qu.:5.000    3rd Qu.:5.00  
##  Max.   :7.00    Max.   :7.000    Max.   :7.000    Max.   :7.00  
##  NA's   :68      NA's   :68       NA's   :68       NA's   :68    
##     hsc2_T2         hsc3_T2         hsc4_T2         hsc5_T2     
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:3.000   1st Qu.:4.000   1st Qu.:4.000   1st Qu.:4.000  
##  Median :4.000   Median :5.000   Median :4.000   Median :5.000  
##  Mean   :4.035   Mean   :4.709   Mean   :4.224   Mean   :5.247  
##  3rd Qu.:5.000   3rd Qu.:6.000   3rd Qu.:5.000   3rd Qu.:6.000  
##  Max.   :7.000   Max.   :7.000   Max.   :7.000   Max.   :7.000  
##  NA's   :68      NA's   :68      NA's   :68      NA's   :68     
##     hsc6_T2         hsc7_T2         hsc8_T2       hsc9_T2     
##  Min.   :1.000   Min.   :1.000   Min.   :1.0   Min.   :1.000  
##  1st Qu.:4.000   1st Qu.:4.000   1st Qu.:4.0   1st Qu.:4.000  
##  Median :5.000   Median :5.000   Median :4.0   Median :4.000  
##  Mean   :4.808   Mean   :4.794   Mean   :4.5   Mean   :4.134  
##  3rd Qu.:6.000   3rd Qu.:6.000   3rd Qu.:5.0   3rd Qu.:5.000  
##  Max.   :7.000   Max.   :7.000   Max.   :7.0   Max.   :7.000  
##  NA's   :68      NA's   :68      NA's   :68    NA's   :68     
##     hsc10_T2       hsc11_T2        hsc12_T2       health1_T2   
##  Min.   :1.00   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:5.00   1st Qu.:4.000   1st Qu.:4.000   1st Qu.:4.000  
##  Median :6.00   Median :5.000   Median :4.000   Median :4.000  
##  Mean   :5.57   Mean   :4.613   Mean   :4.596   Mean   :4.061  
##  3rd Qu.:7.00   3rd Qu.:6.000   3rd Qu.:5.000   3rd Qu.:5.000  
##  Max.   :7.00   Max.   :7.000   Max.   :7.000   Max.   :6.000  
##  NA's   :68     NA's   :68      NA's   :68      NA's   :68     
##    health2_T2      health3_T2      health4_T2      health5_T2   
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:3.000   1st Qu.:3.000   1st Qu.:3.000   1st Qu.:3.000  
##  Median :4.000   Median :4.000   Median :4.000   Median :4.000  
##  Mean   :3.887   Mean   :3.898   Mean   :3.674   Mean   :3.852  
##  3rd Qu.:5.000   3rd Qu.:5.000   3rd Qu.:5.000   3rd Qu.:5.000  
##  Max.   :6.000   Max.   :6.000   Max.   :6.000   Max.   :6.000  
##  NA's   :68      NA's   :68      NA's   :68      NA's   :68     
##     bis1r_T2        bas1_T2         bas2_T2         bas3_T2     
##  Min.   :1.000   Min.   :1.000   Min.   :2.000   Min.   :1.000  
##  1st Qu.:2.000   1st Qu.:2.000   1st Qu.:3.000   1st Qu.:2.750  
##  Median :2.000   Median :3.000   Median :3.000   Median :3.000  
##  Mean   :2.413   Mean   :2.669   Mean   :3.177   Mean   :2.884  
##  3rd Qu.:3.000   3rd Qu.:3.000   3rd Qu.:4.000   3rd Qu.:3.000  
##  Max.   :4.000   Max.   :4.000   Max.   :4.000   Max.   :4.000  
##  NA's   :68      NA's   :68      NA's   :68      NA's   :68     
##     bas4_T2         bis2_T2         bas5_T2         bas6_T2     
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:3.000   1st Qu.:2.000   1st Qu.:2.000   1st Qu.:2.000  
##  Median :3.000   Median :3.000   Median :3.000   Median :3.000  
##  Mean   :3.017   Mean   :2.951   Mean   :2.637   Mean   :2.608  
##  3rd Qu.:3.000   3rd Qu.:3.000   3rd Qu.:3.000   3rd Qu.:3.000  
##  Max.   :4.000   Max.   :4.000   Max.   :4.000   Max.   :4.000  
##  NA's   :68      NA's   :68      NA's   :68      NA's   :68     
##     bas7_T2         bis3_T2         bas8_T2         bas9_T2     
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:2.000   1st Qu.:2.000   1st Qu.:2.000   1st Qu.:2.000  
##  Median :3.000   Median :3.000   Median :3.000   Median :2.000  
##  Mean   :2.642   Mean   :2.672   Mean   :2.718   Mean   :2.352  
##  3rd Qu.:3.000   3rd Qu.:3.000   3rd Qu.:3.000   3rd Qu.:3.000  
##  Max.   :4.000   Max.   :4.000   Max.   :4.000   Max.   :4.000  
##  NA's   :68      NA's   :68      NA's   :68      NA's   :68     
##     bis4_T2         bas10_T2        bis5_T2         bas11_T2    
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:2.000   1st Qu.:2.000   1st Qu.:2.000   1st Qu.:2.000  
##  Median :2.000   Median :3.000   Median :3.000   Median :2.000  
##  Mean   :2.509   Mean   :2.765   Mean   :2.683   Mean   :2.346  
##  3rd Qu.:3.000   3rd Qu.:3.000   3rd Qu.:3.000   3rd Qu.:3.000  
##  Max.   :4.000   Max.   :4.000   Max.   :4.000   Max.   :4.000  
##  NA's   :68      NA's   :68      NA's   :68      NA's   :68     
##     bas12_T2        bis6r_T2        bas13_T2        bis7_T2     
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:2.000   1st Qu.:2.000   1st Qu.:2.000   1st Qu.:2.000  
##  Median :3.000   Median :3.000   Median :3.000   Median :2.000  
##  Mean   :2.576   Mean   :2.535   Mean   :2.744   Mean   :2.358  
##  3rd Qu.:3.000   3rd Qu.:3.000   3rd Qu.:3.000   3rd Qu.:3.000  
##  Max.   :4.000   Max.   :4.000   Max.   :4.000   Max.   :4.000  
##  NA's   :68      NA's   :68      NA's   :68      NA's   :68     
##     bis1_T2         bis6_T2       eoe_mean_T1     na.rm        
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Mode:logical  
##  1st Qu.:2.000   1st Qu.:2.000   1st Qu.:3.800   TRUE:412      
##  Median :3.000   Median :2.000   Median :4.400                 
##  Mean   :2.587   Mean   :2.465   Mean   :4.419                 
##  3rd Qu.:3.000   3rd Qu.:3.000   3rd Qu.:5.000                 
##  Max.   :4.000   Max.   :4.000   Max.   :7.000                 
##  NA's   :68      NA's   :68                                    
##   eoe_mean_T2     lst_mean_T1     lst_mean_T2     aes_mean_T1   
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:4.000   1st Qu.:3.500   1st Qu.:3.500   1st Qu.:4.250  
##  Median :4.400   Median :4.500   Median :4.000   Median :5.000  
##  Mean   :4.452   Mean   :4.382   Mean   :4.324   Mean   :4.939  
##  3rd Qu.:5.000   3rd Qu.:5.000   3rd Qu.:5.000   3rd Qu.:5.500  
##  Max.   :7.000   Max.   :7.000   Max.   :7.000   Max.   :7.000  
##  NA's   :68                      NA's   :68                     
##   aes_mean_T2     hsc_mean_T1     hsc_mean_T2    health_mean_T1 
##  Min.   :2.000   Min.   :1.000   Min.   :1.750   Min.   :1.000  
##  1st Qu.:4.250   1st Qu.:4.050   1st Qu.:4.062   1st Qu.:2.800  
##  Median :5.000   Median :4.600   Median :4.517   Median :3.400  
##  Mean   :4.927   Mean   :4.580   Mean   :4.568   Mean   :3.505  
##  3rd Qu.:5.500   3rd Qu.:5.133   3rd Qu.:5.000   3rd Qu.:4.200  
##  Max.   :7.000   Max.   :7.000   Max.   :7.000   Max.   :6.000  
##  NA's   :68                      NA's   :68                     
##  health_mean_T2  positive_mean_T1 negative_mean_T1 environment_mean_T2
##  Min.   :1.000   Min.   :1.000    Min.   :1.000    Min.   :1.000      
##  1st Qu.:3.400   1st Qu.:2.875    1st Qu.:2.375    1st Qu.:3.818      
##  Median :4.000   Median :3.250    Median :2.875    Median :4.182      
##  Mean   :3.872   Mean   :3.299    Mean   :2.869    Mean   :4.303      
##  3rd Qu.:4.400   3rd Qu.:3.750    3rd Qu.:3.375    3rd Qu.:4.727      
##  Max.   :6.000   Max.   :5.625    Max.   :5.750    Max.   :7.000      
##  NA's   :68                                        NA's   :68         
##   bis_mean_T2     bas_mean_T2   
##  Min.   :1.000   Min.   :2.857  
##  1st Qu.:2.286   1st Qu.:4.571  
##  Median :2.571   Median :5.071  
##  Mean   :2.603   Mean   :5.019  
##  3rd Qu.:2.857   3rd Qu.:5.429  
##  Max.   :4.000   Max.   :7.000  
##  NA's   :68      NA's   :68

2-2-1. HSC_T1の記述統計量

hsc_T1_discriptive <- 
  InputData %>% 
  dplyr::summarise(n = n (), #グループの人数を出力
                   hsc1.T1.mean = mean (hsc1_T1), #hsc1_T1の平均
                   hsc1.T1.sd = sd (hsc1_T1), #hsc1_T1のSD
                   hsc2.T1.mean = mean (hsc2_T1), 
                   hsc2.T1.sd = sd (hsc2_T1),
                   hsc3.T1.mean = mean (hsc3_T1), 
                   hsc3.T1.sd = sd (hsc3_T1),
                   hsc4.T1.mean = mean (hsc4_T1), 
                   hsc4.T1.sd = sd (hsc4_T1),
                   hsc5.T1.mean = mean (hsc5_T1), 
                   hsc5.T1.sd = sd (hsc5_T1),
                   hsc6.T1.mean = mean (hsc6_T1), 
                   hsc6.T1.sd = sd (hsc6_T1),
                   hsc7.T1.mean = mean (hsc7_T1), 
                   hsc7.T1.sd = sd (hsc7_T1),
                   hsc8.T1.mean = mean (hsc8_T1), 
                   hsc8.T1.sd = sd (hsc8_T1),
                   hsc9.T1.mean = mean (hsc9_T1), 
                   hsc9.T1.sd = sd (hsc9_T1),
                   hsc10.T1.mean = mean (hsc10_T1), 
                   hsc10.T1.sd = sd (hsc10_T1),
                   hsc11.T1.mean = mean (hsc11_T1), 
                   hsc11.T1.sd = sd (hsc11_T1),
                   hsc12.T1.mean = mean (hsc4_T1), 
                   hsc12.T1.sd = sd (hsc4_T1),
                   eoe.mean.T1 = mean (eoe_mean_T1),
                   eoe.sd.T1 = sd (eoe_mean_T1),
                   lst.mean.T1 = mean (lst_mean_T1),
                   lst.sd.T1 = sd (lst_mean_T1),
                   aes.mean.T1 = mean (aes_mean_T1),
                   aes.sd.T1 = sd (aes_mean_T1),
                   hsc.mean.T1 = mean (hsc_mean_T1),
                   hsc.sd.T1 = sd (hsc_mean_T1)) 
#ditydataにしたほうがbetter

knitr::kable(hsc_T1_discriptive, digits = 2) #出力
n hsc1.T1.mean hsc1.T1.sd hsc2.T1.mean hsc2.T1.sd hsc3.T1.mean hsc3.T1.sd hsc4.T1.mean hsc4.T1.sd hsc5.T1.mean hsc5.T1.sd hsc6.T1.mean hsc6.T1.sd hsc7.T1.mean hsc7.T1.sd hsc8.T1.mean hsc8.T1.sd hsc9.T1.mean hsc9.T1.sd hsc10.T1.mean hsc10.T1.sd hsc11.T1.mean hsc11.T1.sd hsc12.T1.mean hsc12.T1.sd eoe.mean.T1 eoe.sd.T1 lst.mean.T1 lst.sd.T1 aes.mean.T1 aes.sd.T1 hsc.mean.T1 hsc.sd.T1
412 4.24 1.25 4.15 1.49 4.69 1.43 4.17 1.46 5.21 1.49 4.82 1.35 4.77 1.44 4.4 1.3 4.14 1.25 5.61 1.49 4.62 1.36 4.17 1.46 4.42 0.95 4.38 1.2 4.94 1.03 4.58 0.8

2-2-2. HSC_T2の記述統計量

hsc_T2_discriptive <- 
  InputData %>% 
  drop_na() %>% #T2は欠損値があるのでdrop_na()を挟む
  dplyr::summarise(n = n (), #グループの人数を出力
                   hsc1.T2.mean = mean (hsc1_T2), #hsc1_T2の平均
                   hsc1.T2.sd = sd (hsc1_T2), #hsc1_T2のSD
                   hsc2.T2.mean = mean (hsc2_T2), 
                   hsc2.T2.sd = sd (hsc2_T2),
                   hsc3.T2.mean = mean (hsc3_T2), 
                   hsc3.T2.sd = sd (hsc3_T2),
                   hsc4.T2.mean = mean (hsc4_T2), 
                   hsc4.T2.sd = sd (hsc4_T2),
                   hsc5.T2.mean = mean (hsc5_T2), 
                   hsc5.T2.sd = sd (hsc5_T2),
                   hsc6.T2.mean = mean (hsc6_T2), 
                   hsc6.T2.sd = sd (hsc6_T2),
                   hsc7.T2.mean = mean (hsc7_T2), 
                   hsc7.T2.sd = sd (hsc7_T2),
                   hsc8.T2.mean = mean (hsc8_T2), 
                   hsc8.T2.sd = sd (hsc8_T2),
                   hsc9.T2.mean = mean (hsc9_T2), 
                   hsc9.T2.sd = sd (hsc9_T2),
                   hsc10.T2.mean = mean (hsc10_T2), 
                   hsc10.T2.sd = sd (hsc10_T2),
                   hsc11.T2.mean = mean (hsc11_T2), 
                   hsc11.T2.sd = sd (hsc11_T2),
                   hsc12.T2.mean = mean (hsc4_T2), 
                   hsc12.T2.sd = sd (hsc4_T2),
                   eoe.mean.T2 = mean (eoe_mean_T2),
                   eoe.sd.T2 = sd (eoe_mean_T2),
                   lst.mean.T2 = mean (lst_mean_T2),
                   lst.sd.T2 = sd (lst_mean_T2),
                   aes.mean.T2 = mean (aes_mean_T2),
                   aes.sd.T2 = sd (aes_mean_T2),
                   hsc.mean.T2 = mean (hsc_mean_T2),
                   hsc.sd.T2 = sd (hsc_mean_T2))
#ditydataにしたほうがbetter

knitr::kable(hsc_T2_discriptive, digits = 2) #出力
n hsc1.T2.mean hsc1.T2.sd hsc2.T2.mean hsc2.T2.sd hsc3.T2.mean hsc3.T2.sd hsc4.T2.mean hsc4.T2.sd hsc5.T2.mean hsc5.T2.sd hsc6.T2.mean hsc6.T2.sd hsc7.T2.mean hsc7.T2.sd hsc8.T2.mean hsc8.T2.sd hsc9.T2.mean hsc9.T2.sd hsc10.T2.mean hsc10.T2.sd hsc11.T2.mean hsc11.T2.sd hsc12.T2.mean hsc12.T2.sd eoe.mean.T2 eoe.sd.T2 lst.mean.T2 lst.sd.T2 aes.mean.T2 aes.sd.T2 hsc.mean.T2 hsc.sd.T2
295 4.22 1.05 4.05 1.29 4.7 1.28 4.22 1.22 5.27 1.38 4.8 1.25 4.8 1.39 4.5 1.18 4.17 1.15 5.6 1.28 4.61 1.35 4.22 1.22 4.46 0.92 4.33 1.13 4.95 0.89 4.58 0.72

2-2-3. 精神的健康_T1の記述統計量

health_T1_discriptive <- 
  InputData %>% 
  dplyr::summarise(n = n (), #グループの人数を出力
                   health1.T1.mean = mean (health1_T1), #health1_T1の平均
                   health1.T1.sd = sd (health1_T1), #health1_T1のSD
                   health2.T1.mean = mean (health2_T1), 
                   health2.T1.sd = sd (health2_T1),
                   health3.T1.mean = mean (health3_T1), 
                   health3.T1.sd = sd (health3_T1),
                   health4.T1.mean = mean (health4_T1), 
                   health4.T1.sd = sd (health4_T1),
                   health5.T1.mean = mean (health5_T1), 
                   health5.T1.sd = sd (health5_T1),
                   health.mean.T1 = mean (health_mean_T1),
                   health.sd.T1 = sd (health_mean_T1))

knitr::kable(health_T1_discriptive, digits = 2) #出力
n health1.T1.mean health1.T1.sd health2.T1.mean health2.T1.sd health3.T1.mean health3.T1.sd health4.T1.mean health4.T1.sd health5.T1.mean health5.T1.sd health.mean.T1 health.sd.T1
412 3.59 1.2 3.58 1.2 3.53 1.17 3.45 1.27 3.31 1.18 3.5 1.04

2-2-4. 精神的健康_T2の記述統計量

health_T2_discriptive <- 
  InputData %>% 
  drop_na() %>%
  dplyr::summarise(n = n (), #グループの人数を出力
                   health1.T2.mean = mean (health1_T2), #health1_T2の平均
                   health1.T2.sd = sd (health1_T2), #health1_T2のSD
                   health2.T2.mean = mean (health2_T2), 
                   health2.T2.sd = sd (health2_T2),
                   health3.T2.mean = mean (health3_T2), 
                   health3.T2.sd = sd (health3_T2),
                   health4.T2.mean = mean (health4_T2), 
                   health4.T2.sd = sd (health4_T2),
                   health5.T2.mean = mean (health5_T2), 
                   health5.T2.sd = sd (health5_T2),
                   health.mean.T2 = mean (health_mean_T2),
                   health.sd.T2 = sd (health_mean_T2))

knitr::kable(health_T2_discriptive, digits = 2) #出力
n health1.T2.mean health1.T2.sd health2.T2.mean health2.T2.sd health3.T2.mean health3.T2.sd health4.T2.mean health4.T2.sd health5.T2.mean health5.T2.sd health.mean.T2 health.sd.T2
295 4.08 1.05 3.91 1.03 3.89 1.08 3.67 1.22 3.87 1.16 3.89 0.93

2-2-5. PANAS_T1の記述統計量

panas_T1_discriptive <- 
  InputData %>% 
  dplyr::summarise(n = n (), #グループの人数を出力
                   panas1.T1.mean = mean (panas1_T1), #panas1_T1の平均
                   panas1.T1.sd = sd (panas1_T1), #panas1_T1のSD
                   panas2.T1.mean = mean (panas2_T1), 
                   panas2.T1.sd = sd (panas2_T1),
                   panas3.T1.mean = mean (panas3_T1), 
                   panas3.T1.sd = sd (panas3_T1),
                   panas4.T1.mean = mean (panas4_T1), 
                   panas4.T1.sd = sd (panas4_T1),
                   panas5.T1.mean = mean (panas5_T1), 
                   panas5.T1.sd = sd (panas5_T1),
                   panas6.T1.mean = mean (panas6_T1), 
                   panas6.T1.sd = sd (panas6_T1),
                   panas7.T1.mean = mean (panas7_T1), 
                   panas7.T1.sd = sd (panas7_T1),
                   panas8.T1.mean = mean (panas8_T1), 
                   panas8.T1.sd = sd (panas8_T1),
                   panas9.T1.mean = mean (panas9_T1), 
                   panas9.T1.sd = sd (panas9_T1),
                   panas10.T1.mean = mean (panas10_T1), 
                   panas10.T1.sd = sd (panas10_T1),
                   panas11.T1.mean = mean (panas11_T1), 
                   panas11.T1.sd = sd (panas11_T1),
                   panas12.T1.mean = mean (panas12_T1), 
                   panas12.T1.sd = sd (panas12_T1),
                   panas13.T1.mean = mean (panas13_T1), 
                   panas13.T1.sd = sd (panas13_T1),
                   panas14.T1.mean = mean (panas14_T1), 
                   panas14.T1.sd = sd (panas14_T1),
                   panas15.T1.mean = mean (panas15_T1), 
                   panas15.T1.sd = sd (panas15_T1),
                   panas16.T1.mean = mean (panas16_T1), 
                   panas16.T1.sd = sd (panas16_T1),
                   positive.mean.T1 = mean (positive_mean_T1),
                   positive.sd.T1 = sd (positive_mean_T1),
                   negative.mean.T1 = mean (negative_mean_T1),
                   negative.sd.T1 = sd (negative_mean_T1))

knitr::kable(panas_T1_discriptive, digits = 2) #出力
n panas1.T1.mean panas1.T1.sd panas2.T1.mean panas2.T1.sd panas3.T1.mean panas3.T1.sd panas4.T1.mean panas4.T1.sd panas5.T1.mean panas5.T1.sd panas6.T1.mean panas6.T1.sd panas7.T1.mean panas7.T1.sd panas8.T1.mean panas8.T1.sd panas9.T1.mean panas9.T1.sd panas10.T1.mean panas10.T1.sd panas11.T1.mean panas11.T1.sd panas12.T1.mean panas12.T1.sd panas13.T1.mean panas13.T1.sd panas14.T1.mean panas14.T1.sd panas15.T1.mean panas15.T1.sd panas16.T1.mean panas16.T1.sd positive.mean.T1 positive.sd.T1 negative.mean.T1 negative.sd.T1
412 2.47 1.13 3.74 0.99 2.3 1.04 3.25 1.01 2.57 1.05 3.22 1.03 3.44 1.1 3.65 1.04 3.17 1.18 3.28 0.98 3.13 1.17 3.53 1.12 2.55 1.03 2.92 0.93 3.31 1.14 2.81 1.07 3.3 0.7 2.87 0.79

2-2-6. 学校環境変化_T2の記述統計量

environment_T2_discriptive <- 
  InputData %>% 
  drop_na() %>%
  dplyr::summarise(n = n (), #グループの人数を出力
                   environment1.T2.mean = mean (environment1_T2), #environment1_T2の平均
                   environment1.T2.sd = sd (environment1_T2), #environment1_T2のSD
                   environment2.T2.mean = mean (environment2_T2), 
                   environment2.T2.sd = sd (environment2_T2),
                   environment3.T2.mean = mean (environment3_T2), 
                   environment3.T2.sd = sd (environment3_T2),
                   environment4.T2.mean = mean (environment4_T2), 
                   environment4.T2.sd = sd (environment4_T2),
                   environment5.T2.mean = mean (environment5_T2), 
                   environment5.T2.sd = sd (environment5_T2),
                   environment6.T2.mean = mean (environment6_T2), 
                   environment6.T2.sd = sd (environment6_T2),
                   environment7.T2.mean = mean (environment7_T2), 
                   environment7.T2.sd = sd (environment7_T2),
                   environment8.T2.mean = mean (environment8_T2), 
                   environment8.T2.sd = sd (environment8_T2),
                   environment9.T2.mean = mean (environment9_T2), 
                   environment9.T2.sd = sd (environment9_T2),
                   environment10.T2.mean = mean (environment10_T2), 
                   environment10.T2.sd = sd (environment10_T2),
                   environment11.T2.mean = mean (environment11_T2), 
                   environment11.T2.sd = sd (environment11_T2),
                   environment.T2.mean = mean (environment_mean_T2),
                   environment.T2.sd = sd (environment_mean_T2))
                   
knitr::kable(environment_T2_discriptive, digits = 2) #出力
n environment1.T2.mean environment1.T2.sd environment2.T2.mean environment2.T2.sd environment3.T2.mean environment3.T2.sd environment4.T2.mean environment4.T2.sd environment5.T2.mean environment5.T2.sd environment6.T2.mean environment6.T2.sd environment7.T2.mean environment7.T2.sd environment8.T2.mean environment8.T2.sd environment9.T2.mean environment9.T2.sd environment10.T2.mean environment10.T2.sd environment11.T2.mean environment11.T2.sd environment.T2.mean environment.T2.sd
295 4.88 1.21 4.74 1.2 4.76 1.23 4.54 1.08 4.33 1.06 4.61 1.16 4.05 1.29 3.93 1.37 3.35 1.64 3.6 1.61 4.42 1.36 4.29 0.83

2-2-7. BIS_T2の記述統計量

bis_T2_discriptive <- 
  InputData %>% 
  drop_na() %>%
  dplyr::summarise(n = n (), #グループの人数を出力
                   bis1.T2.mean = mean (bis1_T2), #bis1_T2の平均
                   bis1.T2.sd = sd (bis1_T2), #bis1_T2のSD
                   bis2.T2.mean = mean (bis2_T2), 
                   bis2.T2.sd = sd (bis2_T2),
                   bis3.T2.mean = mean (bis3_T2), 
                   bis3.T2.sd = sd (bis3_T2),
                   bis4.T2.mean = mean (bis4_T2), 
                   bis4.T2.sd = sd (bis4_T2),
                   bis5.T2.mean = mean (bis5_T2), 
                   bis5.T2.sd = sd (bis5_T2),
                   bis6.T2.mean = mean (bis6_T2), 
                   bis6.T2.sd = sd (bis6_T2),
                   bis7.T2.mean = mean (bis7_T2), 
                   bis7.T2.sd = sd (bis7_T2),
                   bis.T2.mean = mean (bis_mean_T2), 
                   bis.T2.sd = sd (bis_mean_T2))

knitr::kable(bis_T2_discriptive, digits = 2) #出力
n bis1.T2.mean bis1.T2.sd bis2.T2.mean bis2.T2.sd bis3.T2.mean bis3.T2.sd bis4.T2.mean bis4.T2.sd bis5.T2.mean bis5.T2.sd bis6.T2.mean bis6.T2.sd bis7.T2.mean bis7.T2.sd bis.T2.mean bis.T2.sd
295 2.57 0.73 2.98 0.73 2.68 0.7 2.5 0.69 2.69 0.64 2.44 0.7 2.35 0.74 2.6 0.45

2-2-8. BAS_T2の記述統計量

bas_T2_discriptive <- 
  InputData %>% 
  drop_na() %>%
  dplyr::summarise(n = n (), #グループの人数を出力
                   bas1.T2.mean = mean (bas1_T2), #bas1_T2の平均
                   bas1.T2.sd = sd (bas1_T2), #bas1_T2のSD
                   bas2.T2.mean = mean (bas2_T2), 
                   bas2.T2.sd = sd (bas2_T2),
                   bas3.T2.mean = mean (bas3_T2), 
                   bas3.T2.sd = sd (bas3_T2),
                   bas4.T2.mean = mean (bas4_T2), 
                   bas4.T2.sd = sd (bas4_T2),
                   bas5.T2.mean = mean (bas5_T2), 
                   bas5.T2.sd = sd (bas5_T2),
                   bas6.T2.mean = mean (bas6_T2), 
                   bas6.T2.sd = sd (bas6_T2),
                   bas7.T2.mean = mean (bas7_T2), 
                   bas7.T2.sd = sd (bas7_T2),
                   bas8.T2.mean = mean (bas8_T2), 
                   bas8.T2.sd = sd (bas8_T2),
                   bas9.T2.mean = mean (bas9_T2), 
                   bas9.T2.sd = sd (bas9_T2),
                   bas10.T2.mean = mean (bas10_T2), 
                   bas10.T2.sd = sd (bas10_T2),
                   bas11.T2.mean = mean (bas11_T2), 
                   bas11.T2.sd = sd (bas11_T2),
                   bas12.T2.mean = mean (bas12_T2), 
                   bas12.T2.sd = sd (bas12_T2),
                   bas13.T2.mean = mean (bas13_T2), 
                   bas13.T2.sd = sd (bas13_T2),
                   bas.T2.mean = mean (bas_mean_T2), 
                   bas.T2.sd = sd (bas_mean_T2))

knitr::kable(bas_T2_discriptive, digits = 2) #出力
n bas1.T2.mean bas1.T2.sd bas2.T2.mean bas2.T2.sd bas3.T2.mean bas3.T2.sd bas4.T2.mean bas4.T2.sd bas5.T2.mean bas5.T2.sd bas6.T2.mean bas6.T2.sd bas7.T2.mean bas7.T2.sd bas8.T2.mean bas8.T2.sd bas9.T2.mean bas9.T2.sd bas10.T2.mean bas10.T2.sd bas11.T2.mean bas11.T2.sd bas12.T2.mean bas12.T2.sd bas13.T2.mean bas13.T2.sd bas.T2.mean bas.T2.sd
295 2.66 0.7 3.18 0.64 2.87 0.65 3.01 0.63 2.65 0.68 2.62 0.68 2.66 0.67 2.72 0.64 2.33 0.62 2.77 0.64 2.34 0.67 2.6 0.69 2.72 0.66 5.02 0.7

2-3. メイン変数の性別ごとの記述統計量

2-3-1. Time1変数の統計量

Time1_discriptive_by_gender <- 
  InputData %>% 
  dplyr::group_by(child_gender_T1) %>% #性別でグルーピング
  dplyr::summarise(n = n (), #グループの人数を出力
                   hsc_T1_mean = mean (hsc_mean_T1), #hsc_T1の平均
                   hsc_T1_sd = sd (hsc_mean_T1), #hcs_T1のSD
                   eoe_T1_mean = mean (eoe_mean_T1), #eoe_T1の平均
                   eoe_T1_sd = sd (eoe_mean_T1), #eoe_T1のSD
                   lst_T1_mean = mean (lst_mean_T1), #lst_T1の平均
                   lst_T1_sd = sd (lst_mean_T1), #lst_T1のSD
                   aes_T1_mean = mean (aes_mean_T1), #aes_T1の平均
                   aes_T1_sd = sd (aes_mean_T1), #aes_T1のSD
                   health_T1_mean = mean (health_mean_T1), #health_T1の平均
                   health_T1_sd = sd (health_mean_T1), #health_T1のSD
                   positive_T1_mean = mean (positive_mean_T1), #positive_T1の平均値
                   positive_T1_sd = sd (positive_mean_T1), #positive_T1のSD
                   negative_T1_mean = mean (negative_mean_T1), #negative_T1の平均値
                   negative_T1_sd = sd (negative_mean_T1)) #negative_T1のSD

knitr::kable(Time1_discriptive_by_gender, digits = 2) #出力
child_gender_T1 n hsc_T1_mean hsc_T1_sd eoe_T1_mean eoe_T1_sd lst_T1_mean lst_T1_sd aes_T1_mean aes_T1_sd health_T1_mean health_T1_sd positive_T1_mean positive_T1_sd negative_T1_mean negative_T1_sd
0 206 4.47 0.72 4.34 0.88 4.32 1.17 4.76 0.95 3.51 1.07 3.21 0.71 2.76 0.80
1 206 4.69 0.86 4.50 1.00 4.45 1.24 5.12 1.07 3.50 1.01 3.38 0.68 2.97 0.77

2-3-2. Time2変数の統計量

Time2_discriptive_by_gender <- 
  InputData %>%
  drop_na() %>%
  dplyr::group_by(child_gender_T1) %>% #性別でグルーピング
  dplyr::summarise(n = n (), #グループの人数を出力
                   hsc_T2_mean = mean (hsc_mean_T2), #hsc_T2の平均
                   hsc_T2_sd = sd (hsc_mean_T2), #hcs_T2のSD
                   eoe_T2_mean = mean (eoe_mean_T2), #eoe_T2の平均
                   eoe_T2_sd = sd (eoe_mean_T2), #eoe_T2のSD
                   lst_T2_mean = mean (lst_mean_T2), #lst_T2の平均
                   lst_T2_sd = sd (lst_mean_T2), #lst_T2のSD
                   aes_T2_mean = mean (aes_mean_T2), #aes_T2の平均
                   aes_T2_sd = sd (aes_mean_T2), #aes_T2のSD
                   health_T2_mean = mean (health_mean_T2), #health_T2の平均
                   health_T2_sd = sd (health_mean_T2), #health_T2のSD
                   environment_T2_mean = mean (environment_mean_T2), #environment_T2の平均値
                   environment_T2_sd = sd (environment_mean_T2), #environment_T2のSD
                   bis_T2_mean = mean (bis_mean_T2), #bis_T2の平均値
                   bis_T2_sd = sd (bis_mean_T2), #bis_T2のSD
                   bas_T2_mean = mean (bas_mean_T2), #bas_T2の平均値
                   bas_T2_sd = sd (bas_mean_T2)) #bas_T2のSD) 

knitr::kable(Time2_discriptive_by_gender, digits = 2) #出力
child_gender_T1 n hsc_T2_mean hsc_T2_sd eoe_T2_mean eoe_T2_sd lst_T2_mean lst_T2_sd aes_T2_mean aes_T2_sd health_T2_mean health_T2_sd environment_T2_mean environment_T2_sd bis_T2_mean bis_T2_sd bas_T2_mean bas_T2_sd
0 147 4.43 0.73 4.35 0.97 4.17 1.12 4.76 0.89 3.86 0.93 4.37 0.85 2.51 0.44 4.95 0.67
1 148 4.73 0.68 4.56 0.86 4.49 1.11 5.14 0.84 3.91 0.93 4.21 0.80 2.69 0.45 5.09 0.73

2-4. 信頼性係数

  • 出力の見方はhttps://mumu.jpn.ph/forest/computer/2016/05/29/5049/など
  • psychパッケージのomega関数を使用する
  • GPArotationパッケージも必要
  • omega(データ, nfactor=尺度の因子数, fm=推定法)
  • 因子数のデフォは3(1に指定するとエラー)
  • 推定法のデフォは最小残差法
library(psych)
## 
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
## 
##     %+%, alpha
library(GPArotation)

2-4-1. hscT1

omega(InputData[,c(11:16, 18:22)],3, fm="ml") #hscT1

## Omega 
## Call: omega(m = InputData[, c(11:16, 18:22)], nfactors = 3, fm = "ml")
## Alpha:                 0.78 
## G.6:                   0.81 
## Omega Hierarchical:    0.56 
## Omega H asymptotic:    0.66 
## Omega Total            0.84 
## 
## Schmid Leiman Factor loadings greater than  0.2 
##              g   F1*   F2*   F3*   h2   u2   p2
## hsc1_T1               0.31  0.30 0.20 0.80 0.02
## hsc2_T1   0.44              0.90 1.00 0.00 0.19
## hsc3_T1   0.23        0.49       0.29 0.71 0.17
## hsc4_T1   0.47              0.23 0.30 0.70 0.73
## hsc5_T1   0.26        0.82       0.73 0.27 0.09
## hsc6_T1   0.69  0.26  0.22       0.59 0.41 0.80
## hsc8_T1   0.70  0.31             0.59 0.41 0.83
## hsc9_T1   0.43                   0.26 0.74 0.73
## hsc10_T1  0.37        0.64       0.55 0.45 0.24
## hsc11_T1  0.41              0.28 0.25 0.75 0.65
## hsc12_T1  0.52  0.21             0.32 0.68 0.84
## 
## With eigenvalues of:
##   g F1* F2* F3* 
## 2.2 0.3 1.5 1.0 
## 
## general/max  1.5   max/min =   5.07
## mean percent general =  0.48    with sd =  0.33 and cv of  0.69 
## Explained Common Variance of the general factor =  0.44 
## 
## The degrees of freedom are 25  and the fit is  0.2 
## The number of observations was  412  with Chi Square =  82.37  with prob <  4.8e-08
## The root mean square of the residuals is  0.04 
## The df corrected root mean square of the residuals is  0.06
## RMSEA index =  0.076  and the 10 % confidence intervals are  0.057 0.093
## BIC =  -68.15
## 
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 44  and the fit is  1.24 
## The number of observations was  412  with Chi Square =  503.81  with prob <  2.3e-79
## The root mean square of the residuals is  0.14 
## The df corrected root mean square of the residuals is  0.16 
## 
## RMSEA index =  0.161  and the 10 % confidence intervals are  0.147 0.172
## BIC =  238.88 
## 
## Measures of factor score adequacy             
##                                                  g   F1*  F2*  F3*
## Correlation of scores with factors            0.84  0.38 0.88 0.96
## Multiple R square of scores with factors      0.70  0.15 0.77 0.92
## Minimum correlation of factor score estimates 0.40 -0.71 0.54 0.85
## 
##  Total, General and Subset omega for each subset
##                                                  g  F1*  F2*  F3*
## Omega total for total scores and subscales    0.84 0.74 0.71 0.72
## Omega general for total scores and subscales  0.56 0.63 0.10 0.34
## Omega group for total scores and subscales    0.21 0.11 0.61 0.38

2-4-2. hscT2

omega(InputData[,c(64:69, 71:75)],3, fm="ml") #hscT2

## Omega 
## Call: omega(m = InputData[, c(64:69, 71:75)], nfactors = 3, fm = "ml")
## Alpha:                 0.78 
## G.6:                   0.81 
## Omega Hierarchical:    0.58 
## Omega H asymptotic:    0.69 
## Omega Total            0.84 
## 
## Schmid Leiman Factor loadings greater than  0.2 
##              g   F1*   F2*   F3*   h2   u2   p2
## hsc1_T2               0.27       0.10 0.90 0.00
## hsc2_T2   0.41  0.50             0.42 0.58 0.40
## hsc3_T2               0.60       0.39 0.61 0.03
## hsc4_T2   0.59                   0.38 0.62 0.92
## hsc5_T2   0.33        0.64       0.54 0.46 0.20
## hsc6_T2   0.88                   0.78 0.22 0.99
## hsc8_T2   0.70  0.28             0.57 0.43 0.86
## hsc9_T2   0.39  0.38             0.32 0.68 0.48
## hsc10_T2  0.29        0.69       0.56 0.44 0.15
## hsc11_T2  0.35  0.48             0.36 0.64 0.34
## hsc12_T2  0.60  0.34             0.47 0.53 0.75
## 
## With eigenvalues of:
##    g  F1*  F2*  F3* 
## 2.62 0.91 1.35 0.01 
## 
## general/max  1.94   max/min =   176.11
## mean percent general =  0.47    with sd =  0.36 and cv of  0.78 
## Explained Common Variance of the general factor =  0.54 
## 
## The degrees of freedom are 25  and the fit is  0.16 
## The number of observations was  412  with Chi Square =  64.88  with prob <  2.2e-05
## The root mean square of the residuals is  0.03 
## The df corrected root mean square of the residuals is  0.05
## RMSEA index =  0.063  and the 10 % confidence intervals are  0.044 0.081
## BIC =  -85.64
## 
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 44  and the fit is  1.06 
## The number of observations was  412  with Chi Square =  429.74  with prob <  9.9e-65
## The root mean square of the residuals is  0.14 
## The df corrected root mean square of the residuals is  0.15 
## 
## RMSEA index =  0.147  and the 10 % confidence intervals are  0.134 0.159
## BIC =  164.81 
## 
## Measures of factor score adequacy             
##                                                  g  F1*  F2*   F3*
## Correlation of scores with factors            0.92 0.73 0.84  0.07
## Multiple R square of scores with factors      0.84 0.53 0.71  0.00
## Minimum correlation of factor score estimates 0.68 0.06 0.42 -0.99
## 
##  Total, General and Subset omega for each subset
##                                                  g  F1*  F2* F3*
## Omega total for total scores and subscales    0.84 0.80 0.75  NA
## Omega general for total scores and subscales  0.58 0.53 0.25  NA
## Omega group for total scores and subscales    0.26 0.26 0.49  NA

2-4-3. eoeT1

omega(InputData[,c(18,16,14,19,22)],3, fm="ml") #eoeT1

## Omega 
## Call: omega(m = InputData[, c(18, 16, 14, 19, 22)], nfactors = 3, fm = "ml")
## Alpha:                 0.74 
## G.6:                   0.71 
## Omega Hierarchical:    0.66 
## Omega H asymptotic:    0.81 
## Omega Total            0.82 
## 
## Schmid Leiman Factor loadings greater than  0.2 
##             g  F1*  F2*  F3*   h2   u2   p2
## hsc8_T1  0.75 0.63           0.95 0.05 0.59
## hsc6_T1  0.77           0.31 0.69 0.31 0.86
## hsc4_T1  0.43                0.23 0.77 0.79
## hsc9_T1  0.38      0.22      0.20 0.80 0.70
## hsc12_T1 0.53      0.63      0.67 0.33 0.41
## 
## With eigenvalues of:
##    g  F1*  F2*  F3* 
## 1.75 0.43 0.47 0.10 
## 
## general/max  3.76   max/min =   4.68
## mean percent general =  0.67    with sd =  0.18 and cv of  0.26 
## Explained Common Variance of the general factor =  0.64 
## 
## The degrees of freedom are -2  and the fit is  0 
## The number of observations was  412  with Chi Square =  0  with prob <  NA
## The root mean square of the residuals is  0 
## The df corrected root mean square of the residuals is  NA
## 
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 5  and the fit is  0.05 
## The number of observations was  412  with Chi Square =  21.39  with prob <  0.00068
## The root mean square of the residuals is  0.07 
## The df corrected root mean square of the residuals is  0.09 
## 
## RMSEA index =  0.09  and the 10 % confidence intervals are  0.053 0.13
## BIC =  -8.71 
## 
## Measures of factor score adequacy             
##                                                  g  F1*  F2*   F3*
## Correlation of scores with factors            0.87 0.79 0.71  0.39
## Multiple R square of scores with factors      0.76 0.62 0.50  0.15
## Minimum correlation of factor score estimates 0.52 0.24 0.01 -0.69
## 
##  Total, General and Subset omega for each subset
##                                                  g  F1*  F2*  F3*
## Omega total for total scores and subscales    0.82 0.95 0.59 0.69
## Omega general for total scores and subscales  0.66 0.56 0.37 0.59
## Omega group for total scores and subscales    0.12 0.39 0.21 0.10

2-4-4. eoeT2

omega(InputData[,c(71,69,67,72,75)],3, fm="ml") #eoeT2

## Omega 
## Call: omega(m = InputData[, c(71, 69, 67, 72, 75)], nfactors = 3, fm = "ml")
## Alpha:                 0.8 
## G.6:                   0.78 
## Omega Hierarchical:    0.75 
## Omega H asymptotic:    0.89 
## Omega Total            0.85 
## 
## Schmid Leiman Factor loadings greater than  0.2 
##             g   F1*   F2*   F3*   h2   u2   p2
## hsc8_T2  0.77              0.41 0.76 0.24 0.77
## hsc6_T2  0.81        0.30       0.74 0.26 0.88
## hsc4_T2  0.59                   0.39 0.61 0.90
## hsc9_T2  0.42  0.21             0.24 0.76 0.73
## hsc12_T2 0.65  0.53             0.71 0.29 0.60
## 
## With eigenvalues of:
##    g  F1*  F2*  F3* 
## 2.19 0.35 0.10 0.20 
## 
## general/max  6.21   max/min =   3.44
## mean percent general =  0.78    with sd =  0.12 and cv of  0.16 
## Explained Common Variance of the general factor =  0.77 
## 
## The degrees of freedom are -2  and the fit is  0 
## The number of observations was  412  with Chi Square =  0  with prob <  NA
## The root mean square of the residuals is  0 
## The df corrected root mean square of the residuals is  NA
## 
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 5  and the fit is  0.04 
## The number of observations was  412  with Chi Square =  15.53  with prob <  0.0083
## The root mean square of the residuals is  0.05 
## The df corrected root mean square of the residuals is  0.07 
## 
## RMSEA index =  0.072  and the 10 % confidence intervals are  0.033 0.113
## BIC =  -14.58 
## 
## Measures of factor score adequacy             
##                                                  g   F1*   F2*   F3*
## Correlation of scores with factors            0.90  0.66  0.41  0.55
## Multiple R square of scores with factors      0.81  0.43  0.16  0.30
## Minimum correlation of factor score estimates 0.62 -0.13 -0.67 -0.40
## 
##  Total, General and Subset omega for each subset
##                                                  g  F1*  F2*  F3*
## Omega total for total scores and subscales    0.85 0.67 0.74 0.76
## Omega general for total scores and subscales  0.75 0.52 0.65 0.59
## Omega group for total scores and subscales    0.08 0.15 0.09 0.17

2-4-5. lstT1

omega(InputData[,c(12,21)],2, fm="ml") #lstT1
## 
## Three factors are required for identification -- general factor loadings set to be equal. 
## Proceed with caution. 
## Think about redoing the analysis with alternative values of the 'option' setting.

## Omega 
## Call: omega(m = InputData[, c(12, 21)], nfactors = 2, fm = "ml")
## Alpha:                 0.6 
## G.6:                   0.43 
## Omega Hierarchical:    0 
## Omega H asymptotic:    0 
## Omega Total            0.51 
## 
## Schmid Leiman Factor loadings greater than  0.2 
##          g  F1* F2*  h2  u2 p2
## hsc2_T1    0.55     0.3 0.7  0
## hsc11_T1   0.55     0.3 0.7  0
## 
## With eigenvalues of:
##    g  F1*  F2* 
## 0.00 0.61 0.00 
## 
## general/max  0   max/min =   Inf
## mean percent general =  0    with sd =  0 and cv of  NaN 
## Explained Common Variance of the general factor =  0 
## 
## The degrees of freedom are -2  and the fit is  0.02 
## The number of observations was  412  with Chi Square =  8.84  with prob <  NA
## The root mean square of the residuals is  0.12 
## The df corrected root mean square of the residuals is  NA
## 
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are -1  and the fit is  0.2 
## The number of observations was  412  with Chi Square =  81.96  with prob <  NA
## The root mean square of the residuals is  0.43 
## The df corrected root mean square of the residuals is  NA 
## 
## Measures of factor score adequacy             
##                                                g   F1* F2*
## Correlation of scores with factors             0  0.65   0
## Multiple R square of scores with factors       0  0.43   0
## Minimum correlation of factor score estimates -1 -0.15  -1
## 
##  Total, General and Subset omega for each subset
##                                                  g  F1* F2*
## Omega total for total scores and subscales    0.51 0.43  NA
## Omega general for total scores and subscales  0.00 0.00  NA
## Omega group for total scores and subscales    0.43 0.43  NA

2-4-6. lstT2

omega(InputData[,c(65,74)],2, fm="ml") #lstT2
## 
## Three factors are required for identification -- general factor loadings set to be equal. 
## Proceed with caution. 
## Think about redoing the analysis with alternative values of the 'option' setting.

## Omega 
## Call: omega(m = InputData[, c(65, 74)], nfactors = 2, fm = "ml")
## Alpha:                 0.59 
## G.6:                   0.42 
## Omega Hierarchical:    0 
## Omega H asymptotic:    0 
## Omega Total            0.5 
## 
## Schmid Leiman Factor loadings greater than  0.2 
##          g  F1* F2*  h2  u2 p2
## hsc2_T2    0.54     0.3 0.7  0
## hsc11_T2   0.54     0.3 0.7  0
## 
## With eigenvalues of:
##    g  F1*  F2* 
## 0.00 0.59 0.00 
## 
## general/max  0   max/min =   Inf
## mean percent general =  0    with sd =  0 and cv of  NaN 
## Explained Common Variance of the general factor =  0 
## 
## The degrees of freedom are -2  and the fit is  0.02 
## The number of observations was  412  with Chi Square =  8.6  with prob <  NA
## The root mean square of the residuals is  0.12 
## The df corrected root mean square of the residuals is  NA
## 
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are -1  and the fit is  0.19 
## The number of observations was  412  with Chi Square =  78.48  with prob <  NA
## The root mean square of the residuals is  0.42 
## The df corrected root mean square of the residuals is  NA 
## 
## Measures of factor score adequacy             
##                                                g   F1* F2*
## Correlation of scores with factors             0  0.65   0
## Multiple R square of scores with factors       0  0.42   0
## Minimum correlation of factor score estimates -1 -0.16  -1
## 
##  Total, General and Subset omega for each subset
##                                                  g  F1* F2*
## Omega total for total scores and subscales    0.50 0.42  NA
## Omega general for total scores and subscales  0.00 0.00  NA
## Omega group for total scores and subscales    0.42 0.42  NA

2-4-7. aesT1

omega(InputData[,c(15,20,11,13)],3, fm="ml") #aesT1

## Omega 
## Call: omega(m = InputData[, c(15, 20, 11, 13)], nfactors = 3, fm = "ml")
## Alpha:                 0.69 
## G.6:                   0.66 
## Omega Hierarchical:    0.7 
## Omega H asymptotic:    0.88 
## Omega Total            0.79 
## 
## Schmid Leiman Factor loadings greater than  0.2 
##             g   F1*   F2*   F3*   h2   u2   p2
## hsc5_T1  0.81  0.59             1.00 0.00 0.65
## hsc10_T1 0.75        0.51       0.82 0.18 0.69
## hsc1_T1  0.29                   0.10 0.90 0.83
## hsc3_T1  0.56              0.23 0.37 0.63 0.86
## 
## With eigenvalues of:
##    g  F1*  F2*  F3* 
## 1.62 0.35 0.26 0.06 
## 
## general/max  4.64   max/min =   5.54
## mean percent general =  0.76    with sd =  0.1 and cv of  0.14 
## Explained Common Variance of the general factor =  0.71 
## 
## The degrees of freedom are -3  and the fit is  0 
## The number of observations was  412  with Chi Square =  0  with prob <  NA
## The root mean square of the residuals is  0 
## The df corrected root mean square of the residuals is  NA
## 
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 2  and the fit is  0.01 
## The number of observations was  412  with Chi Square =  2.47  with prob <  0.29
## The root mean square of the residuals is  0.02 
## The df corrected root mean square of the residuals is  0.04 
## 
## RMSEA index =  0.024  and the 10 % confidence intervals are  0 0.104
## BIC =  -9.57 
## 
## Measures of factor score adequacy             
##                                                  g  F1*   F2*   F3*
## Correlation of scores with factors            0.89 0.77  0.65  0.28
## Multiple R square of scores with factors      0.79 0.59  0.43  0.08
## Minimum correlation of factor score estimates 0.57 0.19 -0.14 -0.85
## 
##  Total, General and Subset omega for each subset
##                                                  g  F1*  F2*  F3*
## Omega total for total scores and subscales    0.79 0.99 0.82 0.35
## Omega general for total scores and subscales  0.70 0.65 0.57 0.31
## Omega group for total scores and subscales    0.09 0.34 0.26 0.05

2-4-8. aesT2

omega(InputData[,c(68,73,64,66)],3, fm="ml") #aesT2

## Omega 
## Call: omega(m = InputData[, c(68, 73, 64, 66)], nfactors = 3, fm = "ml")
## Alpha:                 0.65 
## G.6:                   0.62 
## Omega Hierarchical:    0.61 
## Omega H asymptotic:    0.77 
## Omega Total            0.79 
## 
## Schmid Leiman Factor loadings greater than  0.2 
##             g   F1*  F2*  F3*   h2   u2   p2
## hsc5_T2  0.87                 0.78 0.22 0.98
## hsc10_T2 0.63  0.75           0.96 0.04 0.42
## hsc1_T2  0.24            0.44 0.25 0.75 0.22
## hsc3_T2  0.44  0.22      0.31 0.34 0.66 0.58
## 
## With eigenvalues of:
##    g  F1*  F2*  F3* 
## 1.41 0.61 0.01 0.29 
## 
## general/max  2.31   max/min =   42.13
## mean percent general =  0.55    with sd =  0.32 and cv of  0.59 
## Explained Common Variance of the general factor =  0.61 
## 
## The degrees of freedom are -3  and the fit is  0 
## The number of observations was  412  with Chi Square =  0  with prob <  NA
## The root mean square of the residuals is  0 
## The df corrected root mean square of the residuals is  NA
## 
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 2  and the fit is  0.08 
## The number of observations was  412  with Chi Square =  30.97  with prob <  1.9e-07
## The root mean square of the residuals is  0.09 
## The df corrected root mean square of the residuals is  0.15 
## 
## RMSEA index =  0.188  and the 10 % confidence intervals are  0.133 0.249
## BIC =  18.93 
## 
## Measures of factor score adequacy             
##                                                 g  F1*   F2*   F3*
## Correlation of scores with factors            0.9 0.90  0.15  0.53
## Multiple R square of scores with factors      0.8 0.81  0.02  0.28
## Minimum correlation of factor score estimates 0.6 0.63 -0.96 -0.44
## 
##  Total, General and Subset omega for each subset
##                                                  g  F1*  F2*  F3*
## Omega total for total scores and subscales    0.79 0.96 0.78 0.42
## Omega general for total scores and subscales  0.61 0.40 0.76 0.19
## Omega group for total scores and subscales    0.15 0.56 0.01 0.23

2-4-9. mentalT1

omega(InputData[,23:27],3, fm="ml") #mentalT1

## Omega 
## Call: omega(m = InputData[, 23:27], nfactors = 3, fm = "ml")
## Alpha:                 0.88 
## G.6:                   0.87 
## Omega Hierarchical:    0.81 
## Omega H asymptotic:    0.87 
## Omega Total            0.93 
## 
## Schmid Leiman Factor loadings greater than  0.2 
##               g   F1*   F2*   F3*   h2   u2   p2
## health1_T1 0.93              0.37 0.99 0.01 0.86
## health2_T1 0.87        0.49       0.99 0.01 0.76
## health3_T1 0.63  0.37             0.54 0.46 0.74
## health4_T1 0.63  0.26             0.50 0.50 0.81
## health5_T1 0.64  0.55             0.71 0.29 0.58
## 
## With eigenvalues of:
##    g  F1*  F2*  F3* 
## 2.83 0.51 0.27 0.14 
## 
## general/max  5.6   max/min =   3.61
## mean percent general =  0.75    with sd =  0.11 and cv of  0.14 
## Explained Common Variance of the general factor =  0.76 
## 
## The degrees of freedom are -2  and the fit is  0 
## The number of observations was  412  with Chi Square =  0  with prob <  NA
## The root mean square of the residuals is  0 
## The df corrected root mean square of the residuals is  NA
## 
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 5  and the fit is  0.19 
## The number of observations was  412  with Chi Square =  76.09  with prob <  5.5e-15
## The root mean square of the residuals is  0.09 
## The df corrected root mean square of the residuals is  0.13 
## 
## RMSEA index =  0.187  and the 10 % confidence intervals are  0.15 0.224
## BIC =  45.99 
## 
## Measures of factor score adequacy             
##                                                  g  F1*  F2*   F3*
## Correlation of scores with factors            0.95 0.74 0.84  0.66
## Multiple R square of scores with factors      0.91 0.55 0.71  0.44
## Minimum correlation of factor score estimates 0.82 0.09 0.42 -0.13
## 
##  Total, General and Subset omega for each subset
##                                                  g  F1*  F2*  F3*
## Omega total for total scores and subscales    0.93 0.80 0.99 0.99
## Omega general for total scores and subscales  0.81 0.58 0.76 0.86
## Omega group for total scores and subscales    0.10 0.22 0.24 0.14

2-4-10. mentalT2

omega(InputData[,76:80],3, fm="ml") #mentalT2

## Omega 
## Call: omega(m = InputData[, 76:80], nfactors = 3, fm = "ml")
## Alpha:                 0.89 
## G.6:                   0.88 
## Omega Hierarchical:    0.81 
## Omega H asymptotic:    0.88 
## Omega Total            0.92 
## 
## Schmid Leiman Factor loadings greater than  0.2 
##               g  F1*  F2*   F3*   h2   u2   p2
## health1_T2 0.75 0.49            0.81 0.19 0.70
## health2_T2 0.72 0.56            0.86 0.14 0.61
## health3_T2 0.74 0.26      -0.21 0.65 0.35 0.84
## health4_T2 0.65            0.27 0.51 0.49 0.84
## health5_T2 0.87                 0.77 0.23 0.99
## 
## With eigenvalues of:
##    g  F1*  F2*  F3* 
## 2.81 0.63 0.01 0.15 
## 
## general/max  4.46   max/min =   100.94
## mean percent general =  0.8    with sd =  0.15 and cv of  0.18 
## Explained Common Variance of the general factor =  0.78 
## 
## The degrees of freedom are -2  and the fit is  0 
## The number of observations was  412  with Chi Square =  0  with prob <  NA
## The root mean square of the residuals is  0 
## The df corrected root mean square of the residuals is  NA
## 
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 5  and the fit is  0.42 
## The number of observations was  412  with Chi Square =  170.97  with prob <  4.5e-35
## The root mean square of the residuals is  0.1 
## The df corrected root mean square of the residuals is  0.15 
## 
## RMSEA index =  0.285  and the 10 % confidence intervals are  0.249 0.322
## BIC =  140.86 
## 
## Measures of factor score adequacy             
##                                                  g  F1*   F2*   F3*
## Correlation of scores with factors            0.92 0.77  0.09  0.54
## Multiple R square of scores with factors      0.86 0.59  0.01  0.29
## Minimum correlation of factor score estimates 0.71 0.18 -0.98 -0.41
## 
##  Total, General and Subset omega for each subset
##                                                  g  F1* F2*  F3*
## Omega total for total scores and subscales    0.92 0.91  NA 0.76
## Omega general for total scores and subscales  0.81 0.67  NA 0.75
## Omega group for total scores and subscales    0.10 0.24  NA 0.01

2-4-11. positiveT1

omega(InputData[,c(29,31,33,35,37,39,41,43)],3, fm="ml") #positiveT1

## Omega 
## Call: omega(m = InputData[, c(29, 31, 33, 35, 37, 39, 41, 43)], nfactors = 3, 
##     fm = "ml")
## Alpha:                 0.84 
## G.6:                   0.83 
## Omega Hierarchical:    0.72 
## Omega H asymptotic:    0.83 
## Omega Total            0.87 
## 
## Schmid Leiman Factor loadings greater than  0.2 
##               g   F1*   F2*   F3*   h2   u2   p2
## panas2_T1  0.67  0.39             0.61 0.39 0.74
## panas4_T1  0.65                   0.51 0.49 0.83
## panas6_T1  0.63              0.54 0.69 0.31 0.57
## panas8_T1  0.59                   0.42 0.58 0.84
## panas10_T1 0.54        0.30       0.40 0.60 0.73
## panas12_T1 0.64  0.31             0.53 0.47 0.78
## panas14_T1 0.47        0.55       0.53 0.47 0.42
## panas16_T1 0.46        0.21       0.28 0.72 0.75
## 
## With eigenvalues of:
##    g  F1*  F2*  F3* 
## 2.76 0.32 0.50 0.38 
## 
## general/max  5.48   max/min =   1.57
## mean percent general =  0.71    with sd =  0.14 and cv of  0.2 
## Explained Common Variance of the general factor =  0.7 
## 
## The degrees of freedom are 7  and the fit is  0.02 
## The number of observations was  412  with Chi Square =  6.4  with prob <  0.49
## The root mean square of the residuals is  0.01 
## The df corrected root mean square of the residuals is  0.03
## RMSEA index =  0  and the 10 % confidence intervals are  0 0.057
## BIC =  -35.75
## 
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 20  and the fit is  0.17 
## The number of observations was  412  with Chi Square =  68.46  with prob <  3.2e-07
## The root mean square of the residuals is  0.07 
## The df corrected root mean square of the residuals is  0.09 
## 
## RMSEA index =  0.077  and the 10 % confidence intervals are  0.057 0.097
## BIC =  -51.96 
## 
## Measures of factor score adequacy             
##                                                  g   F1*   F2*   F3*
## Correlation of scores with factors            0.86  0.48  0.64  0.63
## Multiple R square of scores with factors      0.74  0.23  0.41  0.39
## Minimum correlation of factor score estimates 0.47 -0.53 -0.18 -0.22
## 
##  Total, General and Subset omega for each subset
##                                                  g  F1*  F2*  F3*
## Omega total for total scores and subscales    0.87 0.74 0.64 0.72
## Omega general for total scores and subscales  0.72 0.62 0.42 0.54
## Omega group for total scores and subscales    0.08 0.13 0.22 0.18

2-4-12. negativeT1

omega(InputData[,c(28,30,32,34,36,38,40,42)],3, fm="ml") #negativeT1

## Omega 
## Call: omega(m = InputData[, c(28, 30, 32, 34, 36, 38, 40, 42)], nfactors = 3, 
##     fm = "ml")
## Alpha:                 0.86 
## G.6:                   0.88 
## Omega Hierarchical:    0.64 
## Omega H asymptotic:    0.71 
## Omega Total            0.91 
## 
## Schmid Leiman Factor loadings greater than  0.2 
##               g   F1*   F2*   F3*   h2   u2   p2
## panas1_T1  0.80        0.55       0.95 0.05 0.68
## panas3_T1  0.77        0.35  0.24 0.76 0.24 0.77
## panas5_T1  0.70              0.44 0.70 0.30 0.70
## panas7_T1  0.47  0.46             0.45 0.55 0.48
## panas9_T1  0.50  0.53             0.54 0.46 0.47
## panas11_T1 0.44  0.63             0.58 0.42 0.33
## panas13_T1 0.47  0.23        0.21 0.32 0.68 0.69
## panas15_T1 0.45  0.61             0.58 0.42 0.35
## 
## With eigenvalues of:
##    g  F1*  F2*  F3* 
## 2.79 1.32 0.44 0.34 
## 
## general/max  2.12   max/min =   3.92
## mean percent general =  0.56    with sd =  0.17 and cv of  0.31 
## Explained Common Variance of the general factor =  0.57 
## 
## The degrees of freedom are 7  and the fit is  0.02 
## The number of observations was  412  with Chi Square =  9.91  with prob <  0.19
## The root mean square of the residuals is  0.01 
## The df corrected root mean square of the residuals is  0.03
## RMSEA index =  0.033  and the 10 % confidence intervals are  0 0.073
## BIC =  -32.24
## 
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 20  and the fit is  0.96 
## The number of observations was  412  with Chi Square =  390.14  with prob <  2.3e-70
## The root mean square of the residuals is  0.16 
## The df corrected root mean square of the residuals is  0.19 
## 
## RMSEA index =  0.213  and the 10 % confidence intervals are  0.194 0.231
## BIC =  269.72 
## 
## Measures of factor score adequacy             
##                                                  g  F1*   F2*   F3*
## Correlation of scores with factors            0.87 0.81  0.67  0.64
## Multiple R square of scores with factors      0.75 0.65  0.46  0.41
## Minimum correlation of factor score estimates 0.50 0.30 -0.09 -0.17
## 
##  Total, General and Subset omega for each subset
##                                                  g  F1*  F2*  F3*
## Omega total for total scores and subscales    0.91 0.81 0.91 0.68
## Omega general for total scores and subscales  0.64 0.38 0.68 0.49
## Omega group for total scores and subscales    0.21 0.43 0.22 0.20

2-4-13. environmentT2

omega(InputData[,53:63],3, fm="ml") #environmentT2

## Omega 
## Call: omega(m = InputData[, 53:63], nfactors = 3, fm = "ml")
## Alpha:                 0.86 
## G.6:                   0.91 
## Omega Hierarchical:    0.51 
## Omega H asymptotic:    0.56 
## Omega Total            0.92 
## 
## Schmid Leiman Factor loadings greater than  0.2 
##                     g   F1*   F2*   F3*   h2   u2   p2
## environment1_T2  0.52  0.66             0.71 0.29 0.38
## environment2_T2  0.56  0.70             0.82 0.18 0.39
## environment3_T2  0.48  0.50             0.50 0.50 0.47
## environment4_T2  0.46  0.46             0.44 0.56 0.47
## environment5_T2  0.49  0.49             0.50 0.50 0.48
## environment6_T2  0.54  0.57             0.62 0.38 0.47
## environment7_T2  0.44              0.74 0.74 0.26 0.26
## environment8_T2  0.46              0.65 0.63 0.37 0.33
## environment9_T2  0.35        0.75       0.69 0.31 0.17
## environment10_T2 0.40        0.89       0.95 0.05 0.16
## environment11_T2 0.41  0.34             0.32 0.68 0.54
## 
## With eigenvalues of:
##   g F1* F2* F3* 
## 2.4 2.1 1.4 1.0 
## 
## general/max  1.16   max/min =   2.03
## mean percent general =  0.37    with sd =  0.13 and cv of  0.35 
## Explained Common Variance of the general factor =  0.35 
## 
## The degrees of freedom are 25  and the fit is  0.5 
## The number of observations was  412  with Chi Square =  201.16  with prob <  1.8e-29
## The root mean square of the residuals is  0.04 
## The df corrected root mean square of the residuals is  0.07
## RMSEA index =  0.132  and the 10 % confidence intervals are  0.114 0.148
## BIC =  50.64
## 
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 44  and the fit is  3.16 
## The number of observations was  412  with Chi Square =  1281.83  with prob <  8e-240
## The root mean square of the residuals is  0.22 
## The df corrected root mean square of the residuals is  0.25 
## 
## RMSEA index =  0.263  and the 10 % confidence intervals are  0.249 0.274
## BIC =  1016.91 
## 
## Measures of factor score adequacy             
##                                                  g  F1*  F2*  F3*
## Correlation of scores with factors            0.73 0.78 0.93 0.81
## Multiple R square of scores with factors      0.53 0.61 0.87 0.66
## Minimum correlation of factor score estimates 0.06 0.21 0.73 0.32
## 
##  Total, General and Subset omega for each subset
##                                                  g  F1*  F2*  F3*
## Omega total for total scores and subscales    0.92 0.88 0.90 0.81
## Omega general for total scores and subscales  0.51 0.41 0.15 0.24
## Omega group for total scores and subscales    0.37 0.47 0.75 0.57

2-4-14. bisT2

omega(InputData[,c(101,86,91,93,95,102)],3, fm="ml") #bisT2

## Omega 
## Call: omega(m = InputData[, c(101, 86, 91, 93, 95, 102)], nfactors = 3, 
##     fm = "ml")
## Alpha:                 0.64 
## G.6:                   0.65 
## Omega Hierarchical:    0.65 
## Omega H asymptotic:    0.85 
## Omega Total            0.76 
## 
## Schmid Leiman Factor loadings greater than  0.2 
##             g   F1*   F2*   F3*   h2   u2   p2
## bis1_T2  0.35        0.55       0.42 0.58 0.30
## bis2_T2  0.53                   0.31 0.69 0.92
## bas8_T2                    0.82 0.71 0.29 0.04
## bis4_T2  0.67                   0.47 0.53 0.95
## bis5_T2  0.84                   0.72 0.28 0.99
## bis6_T2  0.32        0.38       0.32 0.68 0.32
## 
## With eigenvalues of:
##    g  F1*  F2*  F3* 
## 1.70 0.01 0.48 0.73 
## 
## general/max  2.32   max/min =   113.66
## mean percent general =  0.59    with sd =  0.41 and cv of  0.71 
## Explained Common Variance of the general factor =  0.58 
## 
## The degrees of freedom are 0  and the fit is  0 
## The number of observations was  412  with Chi Square =  0  with prob <  NA
## The root mean square of the residuals is  0 
## The df corrected root mean square of the residuals is  NA
## 
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 9  and the fit is  0.18 
## The number of observations was  412  with Chi Square =  72.31  with prob <  5.4e-12
## The root mean square of the residuals is  0.1 
## The df corrected root mean square of the residuals is  0.13 
## 
## RMSEA index =  0.131  and the 10 % confidence intervals are  0.104 0.16
## BIC =  18.12 
## 
## Measures of factor score adequacy             
##                                                  g   F1*   F2*  F3*
## Correlation of scores with factors            0.89  0.07  0.65 0.84
## Multiple R square of scores with factors      0.80  0.00  0.42 0.71
## Minimum correlation of factor score estimates 0.59 -0.99 -0.16 0.41
## 
##  Total, General and Subset omega for each subset
##                                                  g  F1*  F2*  F3*
## Omega total for total scores and subscales    0.76 0.72 0.62 0.60
## Omega general for total scores and subscales  0.65 0.71 0.37 0.21
## Omega group for total scores and subscales    0.17 0.00 0.24 0.40

2-4-15. basT2

omega(InputData[,c(82,83,84,85,87,88,89,91,92,94,96,97,99)],3, fm="ml") #basT2

## Omega 
## Call: omega(m = InputData[, c(82, 83, 84, 85, 87, 88, 89, 91, 92, 94, 
##     96, 97, 99)], nfactors = 3, fm = "ml")
## Alpha:                 0.83 
## G.6:                   0.85 
## Omega Hierarchical:    0.58 
## Omega H asymptotic:    0.68 
## Omega Total            0.86 
## 
## Schmid Leiman Factor loadings greater than  0.2 
##              g   F1*   F2*   F3*   h2   u2   p2
## bas1_T2   0.63  0.36             0.54 0.46 0.75
## bas2_T2   0.37        0.64       0.55 0.45 0.24
## bas3_T2   0.55        0.29       0.43 0.57 0.70
## bas4_T2   0.52        0.49       0.52 0.48 0.52
## bas5_T2   0.73  0.44             0.73 0.27 0.74
## bas6_T2   0.38              0.21 0.24 0.76 0.62
## bas7_T2   0.59  0.29             0.44 0.56 0.77
## bas8_T2   0.46        0.27  0.32 0.39 0.61 0.54
## bas9_T2                     0.28 0.11 0.89 0.26
## bas10_T2  0.30        0.33  0.22 0.25 0.75 0.37
## bas11_T2  0.27              0.70 0.57 0.43 0.13
## bas12_T2  0.38              0.32 0.26 0.74 0.55
## bas13_T2  0.33        0.34  0.36 0.35 0.65 0.31
## 
## With eigenvalues of:
##    g  F1*  F2*  F3* 
## 2.80 0.47 1.07 1.04 
## 
## general/max  2.61   max/min =   2.28
## mean percent general =  0.5    with sd =  0.22 and cv of  0.43 
## Explained Common Variance of the general factor =  0.52 
## 
## The degrees of freedom are 42  and the fit is  0.33 
## The number of observations was  412  with Chi Square =  132.86  with prob <  2.3e-11
## The root mean square of the residuals is  0.04 
## The df corrected root mean square of the residuals is  0.06
## RMSEA index =  0.073  and the 10 % confidence intervals are  0.059 0.087
## BIC =  -120.03
## 
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 65  and the fit is  1.11 
## The number of observations was  412  with Chi Square =  450.84  with prob <  4.2e-59
## The root mean square of the residuals is  0.12 
## The df corrected root mean square of the residuals is  0.13 
## 
## RMSEA index =  0.121  and the 10 % confidence intervals are  0.11 0.131
## BIC =  59.48 
## 
## Measures of factor score adequacy             
##                                                  g   F1*  F2*  F3*
## Correlation of scores with factors            0.83  0.50 0.76 0.79
## Multiple R square of scores with factors      0.69  0.25 0.58 0.62
## Minimum correlation of factor score estimates 0.39 -0.50 0.17 0.24
## 
##  Total, General and Subset omega for each subset
##                                                  g  F1*  F2*  F3*
## Omega total for total scores and subscales    0.86 0.80 0.72 0.66
## Omega general for total scores and subscales  0.58 0.61 0.36 0.30
## Omega group for total scores and subscales    0.16 0.19 0.36 0.36

2-5. 相関係数(zero-order)

  • 論文化に必要な変数間の相関係数を算出
  • 感想:一気に相関検定してくれるコードがあればいいのだが…。アナログな方法しか思いつかない
#相関表1列目
cor.test(InputData$hsc_mean_T1, InputData$hsc_mean_T2, method = "pearson", digits = 2) #hscT1-hscT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T1 and InputData$hsc_mean_T2
## t = 8.923, df = 342, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.3446553 0.5165641
## sample estimates:
##       cor 
## 0.4345594
cor.test(InputData$hsc_mean_T1, InputData$eoe_mean_T1, method = "pearson") #hscT1-eoeT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T1 and InputData$eoe_mean_T1
## t = 24.52, df = 410, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.7287504 0.8075291
## sample estimates:
##      cor 
## 0.771074
cor.test(InputData$hsc_mean_T1, InputData$eoe_mean_T2, method = "pearson") #hscT1-eoeT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T1 and InputData$eoe_mean_T2
## t = 7.2916, df = 342, p-value = 2.144e-12
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2715963 0.4549006
## sample estimates:
##       cor 
## 0.3668033
cor.test(InputData$hsc_mean_T1, InputData$lst_mean_T1, method = "pearson") #hscT1-lstT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T1 and InputData$lst_mean_T1
## t = 27.622, df = 410, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.7698866 0.8378388
## sample estimates:
##     cor 
## 0.80651
cor.test(InputData$hsc_mean_T1, InputData$lst_mean_T2, method = "pearson") #hscT1-lstT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T1 and InputData$lst_mean_T2
## t = 6.2898, df = 342, p-value = 9.713e-10
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2238806 0.4136558
## sample estimates:
##      cor 
## 0.321999
cor.test(InputData$hsc_mean_T1, InputData$aes_mean_T1, method = "pearson") #hscT1-aesT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T1 and InputData$aes_mean_T1
## t = 18.04, df = 410, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.6076562 0.7158228
## sample estimates:
##       cor 
## 0.6652153
cor.test(InputData$hsc_mean_T1, InputData$aes_mean_T2, method = "pearson") #hscT1-aesT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T1 and InputData$aes_mean_T2
## t = 5.3042, df = 342, p-value = 2.037e-07
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1750647 0.3706382
## sample estimates:
##       cor 
## 0.2757022
cor.test(InputData$hsc_mean_T1, InputData$health_mean_T1, method = "pearson") #hscT1-healthT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T1 and InputData$health_mean_T1
## t = -2.5084, df = 410, p-value = 0.01251
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.21697715 -0.02664745
## sample estimates:
##        cor 
## -0.1229426
cor.test(InputData$hsc_mean_T1, InputData$health_mean_T2, method = "pearson") #hscT1-healthT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T1 and InputData$health_mean_T2
## t = -0.30357, df = 342, p-value = 0.7616
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.12194261  0.08948352
## sample estimates:
##         cor 
## -0.01641302
cor.test(InputData$hsc_mean_T1, InputData$positive_mean_T1, method = "pearson") #hscT1-positiveT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T1 and InputData$positive_mean_T1
## t = -0.22525, df = 410, p-value = 0.8219
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.10761973  0.08557999
## sample estimates:
##         cor 
## -0.01112368
cor.test(InputData$hsc_mean_T1, InputData$negative_mean_T1, method = "pearson") #hscT1-negativeT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T1 and InputData$negative_mean_T1
## t = 4.5521, df = 410, p-value = 7.012e-06
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1253811 0.3093915
## sample estimates:
##       cor 
## 0.2193359
cor.test(InputData$hsc_mean_T1, InputData$environment_mean_T2, method = "pearson") #hscT1-environmentT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T1 and InputData$environment_mean_T2
## t = 0.23223, df = 342, p-value = 0.8165
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.09330843  0.11814106
## sample estimates:
##        cor 
## 0.01255669
cor.test(InputData$hsc_mean_T1, InputData$bis_mean_T2, method = "pearson") #hscT1-bisT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T1 and InputData$bis_mean_T2
## t = 6.7614, df = 342, p-value = 5.922e-11
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2465949 0.4333875
## sample estimates:
##       cor 
## 0.3433824
cor.test(InputData$hsc_mean_T1, InputData$bas_mean_T2, method = "pearson") #hscT1-basT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T1 and InputData$bas_mean_T2
## t = 2.2993, df = 342, p-value = 0.02209
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.01787342 0.22617194
## sample estimates:
##       cor 
## 0.1233815
#相関表2列目
cor.test(InputData$hsc_mean_T2, InputData$eoe_mean_T1, method = "pearson") #hscT2-eoeT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T2 and InputData$eoe_mean_T1
## t = 7.376, df = 342, p-value = 1.244e-12
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2755198 0.4582575
## sample estimates:
##       cor 
## 0.3704679
cor.test(InputData$hsc_mean_T2, InputData$eoe_mean_T2, method = "pearson") #hscT2-eoeT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T2 and InputData$eoe_mean_T2
## t = 24.763, df = 342, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.7598584 0.8361255
## sample estimates:
##       cor 
## 0.8012227
cor.test(InputData$hsc_mean_T2, InputData$lst_mean_T1, method = "pearson") #hscT2-lstT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T2 and InputData$lst_mean_T1
## t = 7.5374, df = 342, p-value = 4.339e-13
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2829851 0.4646301
## sample estimates:
##       cor 
## 0.3774323
cor.test(InputData$hsc_mean_T2, InputData$lst_mean_T2, method = "pearson") #hscT2-lstT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T2 and InputData$lst_mean_T2
## t = 25.226, df = 342, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.7660801 0.8405503
## sample estimates:
##       cor 
## 0.8064906
cor.test(InputData$hsc_mean_T2, InputData$aes_mean_T1, method = "pearson") #hscT2-aesT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T2 and InputData$aes_mean_T1
## t = 4.3485, df = 342, p-value = 1.811e-05
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1262086 0.3267283
## sample estimates:
##       cor 
## 0.2288951
cor.test(InputData$hsc_mean_T2, InputData$aes_mean_T2, method = "pearson") #hscT2-aesT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T2 and InputData$aes_mean_T2
## t = 13.741, df = 342, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.5237115 0.6605092
## sample estimates:
##       cor 
## 0.5964241
cor.test(InputData$hsc_mean_T2, InputData$health_mean_T1, method = "pearson") #hscT2-healthT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T2 and InputData$health_mean_T1
## t = -2.4357, df = 342, p-value = 0.01537
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.23310489 -0.02518894
## sample estimates:
##        cor 
## -0.1305824
cor.test(InputData$hsc_mean_T2, InputData$health_mean_T2, method = "pearson") #hscT2-healthT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T2 and InputData$health_mean_T2
## t = -0.88858, df = 342, p-value = 0.3749
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.15295873  0.05804204
## sample estimates:
##         cor 
## -0.04799375
cor.test(InputData$hsc_mean_T2, InputData$positive_mean_T1, method = "pearson") #hscT2-positiveT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T2 and InputData$positive_mean_T1
## t = -2.3711, df = 342, p-value = 0.01829
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.22982210 -0.02172222
## sample estimates:
##        cor 
## -0.1271713
cor.test(InputData$hsc_mean_T2, InputData$negative_mean_T1, method = "pearson") #hscT2-negativeT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T2 and InputData$negative_mean_T1
## t = 4.9709, df = 342, p-value = 1.056e-06
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1581808 0.3555619
## sample estimates:
##       cor 
## 0.2595802
cor.test(InputData$hsc_mean_T2, InputData$environment_mean_T2, method = "pearson") #hscT2-envirionmentT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T2 and InputData$environment_mean_T2
## t = 0.53528, df = 342, p-value = 0.5928
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.07704435  0.13426306
## sample estimates:
##        cor 
## 0.02893259
cor.test(InputData$hsc_mean_T2, InputData$bis_mean_T2, method = "pearson") #hscT2-bisT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T2 and InputData$bis_mean_T2
## t = 9.9035, df = 342, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.3855968 0.5503571
## sample estimates:
##       cor 
## 0.4720893
cor.test(InputData$hsc_mean_T2, InputData$bas_mean_T2, method = "pearson") #hscT2-basT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$hsc_mean_T2 and InputData$bas_mean_T2
## t = 2.571, df = 342, p-value = 0.01056
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.03243059 0.23994709
## sample estimates:
##       cor 
## 0.1376996
#相関表3列目
cor.test(InputData$eoe_mean_T1, InputData$eoe_mean_T2, method = "pearson") #eoeT1-eoeT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$eoe_mean_T1 and InputData$eoe_mean_T2
## t = 10.476, df = 342, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.4084428 0.5689824
## sample estimates:
##       cor 
## 0.4928962
cor.test(InputData$eoe_mean_T1, InputData$lst_mean_T1, method = "pearson") #eoeT1-lstT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$eoe_mean_T1 and InputData$lst_mean_T1
## t = 11.669, df = 410, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.4231176 0.5685052
## sample estimates:
##       cor 
## 0.4993182
cor.test(InputData$eoe_mean_T1, InputData$lst_mean_T2, method = "pearson") #eoeT1-lstT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$eoe_mean_T1 and InputData$lst_mean_T2
## t = 5.2838, df = 342, p-value = 2.258e-07
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1740362 0.3697228
## sample estimates:
##       cor 
## 0.2747218
cor.test(InputData$eoe_mean_T1, InputData$aes_mean_T1, method = "pearson") #eoeT1-aesT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$eoe_mean_T1 and InputData$aes_mean_T1
## t = 5.9861, df = 410, p-value = 4.695e-09
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1921554 0.3699820
## sample estimates:
##      cor 
## 0.283504
cor.test(InputData$eoe_mean_T1, InputData$aes_mean_T2, method = "pearson") #eoeT1-aesT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$eoe_mean_T1 and InputData$aes_mean_T2
## t = 0.98851, df = 342, p-value = 0.3236
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.05266207  0.15822458
## sample estimates:
##        cor 
## 0.05337639
cor.test(InputData$eoe_mean_T1, InputData$health_mean_T1, method = "pearson") #eoeT1-healthT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$eoe_mean_T1 and InputData$health_mean_T1
## t = -5.5641, df = 410, p-value = 4.765e-08
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.3525565 -0.1727813
## sample estimates:
##      cor 
## -0.26497
cor.test(InputData$eoe_mean_T1, InputData$health_mean_T2, method = "pearson") #eoeT1-healthT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$eoe_mean_T1 and InputData$health_mean_T2
## t = -3.849, df = 342, p-value = 0.0001415
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.3029749 -0.1001788
## sample estimates:
##        cor 
## -0.2037615
cor.test(InputData$eoe_mean_T1, InputData$positive_mean_T1, method = "pearson") #eoeT1-positiveT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$eoe_mean_T1 and InputData$positive_mean_T1
## t = -3.7778, df = 410, p-value = 0.0001816
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.27514471 -0.08836243
## sample estimates:
##        cor 
## -0.1834084
cor.test(InputData$eoe_mean_T1, InputData$negative_mean_T1, method = "pearson") #eoeT1-negativeT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$eoe_mean_T1 and InputData$negative_mean_T1
## t = 7.5338, df = 410, p-value = 3.181e-13
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2608886 0.4308090
## sample estimates:
##       cor 
## 0.3487111
cor.test(InputData$eoe_mean_T1, InputData$environment_mean_T2, method = "pearson") #eoeT1-envirionmentT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$eoe_mean_T1 and InputData$environment_mean_T2
## t = -1.2305, df = 342, p-value = 0.2194
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.17093250  0.03962816
## sample estimates:
##         cor 
## -0.06639127
cor.test(InputData$eoe_mean_T1, InputData$bis_mean_T2, method = "pearson") #eoeT1-bisT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$eoe_mean_T1 and InputData$bis_mean_T2
## t = 6.3893, df = 342, p-value = 5.451e-10
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2287083 0.4178646
## sample estimates:
##       cor 
## 0.3265522
cor.test(InputData$eoe_mean_T1, InputData$bas_mean_T2, method = "pearson") #eoeT1-basT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$eoe_mean_T1 and InputData$bas_mean_T2
## t = -0.1868, df = 342, p-value = 0.8519
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.11571807  0.09574305
## sample estimates:
##         cor 
## -0.01010043
#相関表4列目
cor.test(InputData$eoe_mean_T2, InputData$lst_mean_T1, method = "pearson") #eoeT2-lstT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$eoe_mean_T2 and InputData$lst_mean_T1
## t = 5.5222, df = 342, p-value = 6.634e-08
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1860099 0.3803569
## sample estimates:
##       cor 
## 0.2861234
cor.test(InputData$eoe_mean_T2, InputData$lst_mean_T2, method = "pearson") #eoeT2-lstT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$eoe_mean_T2 and InputData$lst_mean_T2
## t = 11.987, df = 342, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.4648980 0.6143121
## sample estimates:
##       cor 
## 0.5439016
cor.test(InputData$eoe_mean_T2, InputData$aes_mean_T1, method = "pearson") #eoeT2-aesT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$eoe_mean_T2 and InputData$aes_mean_T1
## t = 1.2416, df = 342, p-value = 0.2153
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.03903279  0.17151131
## sample estimates:
##        cor 
## 0.06698491
cor.test(InputData$eoe_mean_T2, InputData$aes_mean_T2, method = "pearson") #eoeT2-aesT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$eoe_mean_T2 and InputData$aes_mean_T2
## t = 4.6557, df = 342, p-value = 4.627e-06
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1420609 0.3410713
## sample estimates:
##       cor 
## 0.2441349
cor.test(InputData$eoe_mean_T2, InputData$health_mean_T1, method = "pearson") #eoeT2-healthT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$eoe_mean_T2 and InputData$health_mean_T1
## t = -5.609, df = 342, p-value = 4.202e-08
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.3841959 -0.1903467
## sample estimates:
##       cor 
## -0.290246
cor.test(InputData$eoe_mean_T2, InputData$health_mean_T2, method = "pearson") #eoeT2-healthT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$eoe_mean_T2 and InputData$health_mean_T2
## t = -4.8613, df = 342, p-value = 1.781e-06
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.3505477 -0.1525909
## sample estimates:
##        cor 
## -0.2542301
cor.test(InputData$eoe_mean_T2, InputData$positive_mean_T1, method = "pearson") #eoeT2-positiveT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$eoe_mean_T2 and InputData$positive_mean_T1
## t = -5.0311, df = 342, p-value = 7.893e-07
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.3583061 -0.1612454
## sample estimates:
##        cor 
## -0.2625108
cor.test(InputData$eoe_mean_T2, InputData$negative_mean_T1, method = "pearson") #eoeT2-negativeT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$eoe_mean_T2 and InputData$negative_mean_T1
## t = 6.5213, df = 342, p-value = 2.506e-10
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2350861 0.4234122
## sample estimates:
##       cor 
## 0.3325604
cor.test(InputData$eoe_mean_T2, InputData$environment_mean_T2, method = "pearson") #eoeT2-envirionmentT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$eoe_mean_T2 and InputData$environment_mean_T2
## t = -1.9173, df = 342, p-value = 0.05604
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.206610185  0.002648227
## sample estimates:
##        cor 
## -0.1031219
cor.test(InputData$eoe_mean_T2, InputData$bis_mean_T2, method = "pearson") #eoeT2-bisT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$eoe_mean_T2 and InputData$bis_mean_T2
## t = 11.002, df = 342, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.4287277 0.5853829
## sample estimates:
##     cor 
## 0.51129
cor.test(InputData$eoe_mean_T2, InputData$bas_mean_T2, method = "pearson") #eoeT2-basT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$eoe_mean_T2 and InputData$bas_mean_T2
## t = -0.708, df = 342, p-value = 0.4794
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.14341728  0.06775913
## sample estimates:
##         cor 
## -0.03825621
#相関表5列目
cor.test(InputData$lst_mean_T1, InputData$lst_mean_T2, method = "pearson") #lstT1-lstT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$lst_mean_T1 and InputData$lst_mean_T2
## t = 8.6592, df = 342, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.3332523 0.5070556
## sample estimates:
##       cor 
## 0.4240506
cor.test(InputData$lst_mean_T1, InputData$aes_mean_T1, method = "pearson") #lstT1-aesT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$lst_mean_T1 and InputData$aes_mean_T1
## t = 5.0122, df = 410, p-value = 8.019e-07
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1470872 0.3292527
## sample estimates:
##       cor 
## 0.2402843
cor.test(InputData$lst_mean_T1, InputData$aes_mean_T2, method = "pearson") #lstT1-aesT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$lst_mean_T1 and InputData$aes_mean_T2
## t = 1.7323, df = 342, p-value = 0.08412
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.01260125  0.19706208
## sample estimates:
##        cor 
## 0.09326425
cor.test(InputData$lst_mean_T1, InputData$health_mean_T1, method = "pearson") #lstT1-healthT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$lst_mean_T1 and InputData$health_mean_T1
## t = -2.2038, df = 410, p-value = 0.0281
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.20268988 -0.01170759
## sample estimates:
##        cor 
## -0.1081969
cor.test(InputData$lst_mean_T1, InputData$health_mean_T2, method = "pearson") #lstT1-healthT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$lst_mean_T1 and InputData$health_mean_T2
## t = -0.80699, df = 342, p-value = 0.4202
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.14865131  0.06243371
## sample estimates:
##         cor 
## -0.04359533
cor.test(InputData$lst_mean_T1, InputData$positive_mean_T1, method = "pearson") #lstT1-positiveT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$lst_mean_T1 and InputData$positive_mean_T1
## t = -1.8642, df = 410, p-value = 0.06301
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.186636754  0.004977662
## sample estimates:
##         cor 
## -0.09167813
cor.test(InputData$lst_mean_T1, InputData$negative_mean_T1, method = "pearson") #lstT1-negativeT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$lst_mean_T1 and InputData$negative_mean_T1
## t = 4.4467, df = 410, p-value = 1.124e-05
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1203790 0.3047916
## sample estimates:
##       cor 
## 0.2144961
cor.test(InputData$lst_mean_T1, InputData$environment_mean_T2, method = "pearson") #lstT1-envirionmentT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$lst_mean_T1 and InputData$environment_mean_T2
## t = 0.034699, df = 342, p-value = 0.9723
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1038856  0.1075962
## sample estimates:
##         cor 
## 0.001876282
cor.test(InputData$lst_mean_T1, InputData$bis_mean_T2, method = "pearson") #lstT1-bisT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$lst_mean_T1 and InputData$bis_mean_T2
## t = 5.5691, df = 342, p-value = 5.187e-08
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1883547 0.3824334
## sample estimates:
##       cor 
## 0.2883529
cor.test(InputData$lst_mean_T1, InputData$bas_mean_T2, method = "pearson") #lstT1-basT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$lst_mean_T1 and InputData$bas_mean_T2
## t = -0.38644, df = 342, p-value = 0.6994
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.12635381  0.08503738
## sample estimates:
##         cor 
## -0.02089171
#相関表6列目
cor.test(InputData$lst_mean_T2, InputData$aes_mean_T1, method = "pearson") #lstT2-aesT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$lst_mean_T2 and InputData$aes_mean_T1
## t = 0.060947, df = 342, p-value = 0.9514
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1024813  0.1089989
## sample estimates:
##         cor 
## 0.003295619
cor.test(InputData$lst_mean_T2, InputData$aes_mean_T2, method = "pearson") #lstT2-aesT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$lst_mean_T2 and InputData$aes_mean_T2
## t = 2.8228, df = 342, p-value = 0.005039
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.04588355 0.25260348
## sample estimates:
##       cor 
## 0.1508927
cor.test(InputData$lst_mean_T2, InputData$health_mean_T1, method = "pearson") #lstT2-healthT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$lst_mean_T2 and InputData$health_mean_T1
## t = -2.2863, df = 342, p-value = 0.02285
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.22550938 -0.01717547
## sample estimates:
##        cor 
## -0.1226939
cor.test(InputData$lst_mean_T2, InputData$health_mean_T2, method = "pearson") #lstT2-healthT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$lst_mean_T2 and InputData$health_mean_T2
## t = -2.2124, df = 342, p-value = 0.0276
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.22174015 -0.01320873
## sample estimates:
##        cor 
## -0.1187841
cor.test(InputData$lst_mean_T2, InputData$positive_mean_T1, method = "pearson") #lstT2-positiveT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$lst_mean_T2 and InputData$positive_mean_T1
## t = -3.5651, df = 342, p-value = 0.0004155
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.28924501 -0.08525866
## sample estimates:
##        cor 
## -0.1892933
cor.test(InputData$lst_mean_T2, InputData$negative_mean_T1, method = "pearson") #lstT2-negativeT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$lst_mean_T2 and InputData$negative_mean_T1
## t = 4.0565, df = 342, p-value = 6.175e-05
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1110314 0.3129091
## sample estimates:
##       cor 
## 0.2142571
cor.test(InputData$lst_mean_T2, InputData$environment_mean_T2, method = "pearson") #lstT2-envirionmentT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$lst_mean_T2 and InputData$environment_mean_T2
## t = -0.9434, df = 342, p-value = 0.3461
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.15584883  0.05509083
## sample estimates:
##         cor 
## -0.05094719
cor.test(InputData$lst_mean_T2, InputData$bis_mean_T2, method = "pearson") #lstT2-bisT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$lst_mean_T2 and InputData$bis_mean_T2
## t = 7.0871, df = 342, p-value = 7.876e-12
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2620218 0.4466872
## sample estimates:
##       cor 
## 0.3578483
cor.test(InputData$lst_mean_T2, InputData$bas_mean_T2, method = "pearson") #lstT2-basT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$lst_mean_T2 and InputData$bas_mean_T2
## t = -0.26177, df = 342, p-value = 0.7937
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.11971543  0.09172514
## sample estimates:
##         cor 
## -0.01415337
#相関表7列目
cor.test(InputData$aes_mean_T1, InputData$aes_mean_T2, method = "pearson") #aesT1-aesT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$aes_mean_T1 and InputData$aes_mean_T2
## t = 10.073, df = 342, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.3924352 0.5559493
## sample estimates:
##       cor 
## 0.4783274
cor.test(InputData$aes_mean_T1, InputData$health_mean_T1, method = "pearson") #aesT1-healthT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$aes_mean_T1 and InputData$health_mean_T1
## t = 1.7328, df = 410, p-value = 0.08388
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.01143855  0.18039304
## sample estimates:
##        cor 
## 0.08526738
cor.test(InputData$aes_mean_T1, InputData$health_mean_T2, method = "pearson") #aesT1-healthT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$aes_mean_T1 and InputData$health_mean_T2
## t = 3.7233, df = 342, p-value = 0.0002299
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.0935857 0.2969181
## sample estimates:
##       cor 
## 0.1973737
cor.test(InputData$aes_mean_T1, InputData$positive_mean_T1, method = "pearson") #aesT1-positiveT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$aes_mean_T1 and InputData$positive_mean_T1
## t = 5.2306, df = 410, p-value = 2.7e-07
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1573009 0.3385428
## sample estimates:
##       cor 
## 0.2501116
cor.test(InputData$aes_mean_T1, InputData$negative_mean_T1, method = "pearson") #aesT1-negativeT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$aes_mean_T1 and InputData$negative_mean_T1
## t = -1.2825, df = 410, p-value = 0.2004
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.15885114  0.03360743
## sample estimates:
##        cor 
## -0.0632095
cor.test(InputData$aes_mean_T1, InputData$environment_mean_T2, method = "pearson") #aesT1-envirionmentT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$aes_mean_T1 and InputData$environment_mean_T2
## t = 1.6148, df = 342, p-value = 0.1073
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.01892875  0.19097125
## sample estimates:
##        cor 
## 0.08698659
cor.test(InputData$aes_mean_T1, InputData$bis_mean_T2, method = "pearson") #aesT1-bisT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$aes_mean_T1 and InputData$bis_mean_T2
## t = 3.0274, df = 342, p-value = 0.002654
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.05678109 0.26280416
## sample estimates:
##       cor 
## 0.1615523
cor.test(InputData$aes_mean_T1, InputData$bas_mean_T2, method = "pearson") #aesT1-basT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$aes_mean_T1 and InputData$bas_mean_T2
## t = 6.1805, df = 342, p-value = 1.818e-09
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2185529 0.4090018
## sample estimates:
##      cor 
## 0.316969
#相関表8列目
cor.test(InputData$aes_mean_T2, InputData$health_mean_T1, method = "pearson") #aesT2-healthT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$aes_mean_T2 and InputData$health_mean_T1
## t = 2.4345, df = 342, p-value = 0.01542
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.02512032 0.23303997
## sample estimates:
##       cor 
## 0.1305149
cor.test(InputData$aes_mean_T2, InputData$health_mean_T2, method = "pearson") #aesT2-healthT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$aes_mean_T2 and InputData$health_mean_T2
## t = 5.5576, df = 342, p-value = 5.512e-08
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1877788 0.3819235
## sample estimates:
##       cor 
## 0.2878053
cor.test(InputData$aes_mean_T2, InputData$positive_mean_T1, method = "pearson") #aesT2-positiveT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$aes_mean_T2 and InputData$positive_mean_T1
## t = 3.6434, df = 342, p-value = 0.0003108
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.08938225 0.29304806
## sample estimates:
##       cor 
## 0.1932966
cor.test(InputData$aes_mean_T2, InputData$negative_mean_T1, method = "pearson") #aesT2-negativeT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$aes_mean_T2 and InputData$negative_mean_T1
## t = 0.43148, df = 342, p-value = 0.6664
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.08261982  0.12874887
## sample estimates:
##        cor 
## 0.02332519
cor.test(InputData$aes_mean_T2, InputData$environment_mean_T2, method = "pearson") #aesT2-envirionmentT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$aes_mean_T2 and InputData$environment_mean_T2
## t = 4.5, df = 342, p-value = 9.328e-06
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1340418 0.3338272
## sample estimates:
##       cor 
## 0.2364319
cor.test(InputData$aes_mean_T2, InputData$bis_mean_T2, method = "pearson") #aesT2-bisT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$aes_mean_T2 and InputData$bis_mean_T2
## t = 3.3062, df = 342, p-value = 0.001046
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.07157754 0.27658109
## sample estimates:
##       cor 
## 0.1759868
cor.test(InputData$aes_mean_T2, InputData$bas_mean_T2, method = "pearson") #aesT2-basT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$aes_mean_T2 and InputData$bas_mean_T2
## t = 7.7575, df = 342, p-value = 1.007e-13
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2930709 0.4732100
## sample estimates:
##       cor 
## 0.3868246
#相関表9列目
cor.test(InputData$health_mean_T1, InputData$health_mean_T2, method = "pearson") #healthT1-healthT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$health_mean_T1 and InputData$health_mean_T2
## t = 8.2219, df = 342, p-value = 4.213e-15
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.3139969 0.4909030
## sample estimates:
##       cor 
## 0.4062497
cor.test(InputData$health_mean_T1, InputData$positive_mean_T1, method = "pearson") #healthT1-positiveT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$health_mean_T1 and InputData$positive_mean_T1
## t = 9.2399, df = 410, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.3318448 0.4920244
## sample estimates:
##       cor 
## 0.4151468
cor.test(InputData$health_mean_T1, InputData$negative_mean_T1, method = "pearson") #healthT1-negativeT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$health_mean_T1 and InputData$negative_mean_T1
## t = -9.0084, df = 410, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.4840823 -0.3225354
## sample estimates:
##        cor 
## -0.4064809
cor.test(InputData$health_mean_T1, InputData$environment_mean_T2, method = "pearson") #healthT1-envirionmentT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$health_mean_T1 and InputData$environment_mean_T2
## t = 0.63315, df = 342, p-value = 0.5271
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.07178439  0.13945324
## sample estimates:
##        cor 
## 0.03421657
cor.test(InputData$health_mean_T1, InputData$bis_mean_T2, method = "pearson") #healthT1-bisT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$health_mean_T1 and InputData$bis_mean_T2
## t = -2.4788, df = 342, p-value = 0.01366
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.23528543 -0.02749441
## sample estimates:
##        cor 
## -0.1328494
cor.test(InputData$health_mean_T1, InputData$bas_mean_T2, method = "pearson") #healthT1-basT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$health_mean_T1 and InputData$bas_mean_T2
## t = 3.0475, df = 342, p-value = 0.002487
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.05784989 0.26380214
## sample estimates:
##       cor 
## 0.1625965
#相関表10列目
cor.test(InputData$health_mean_T2, InputData$positive_mean_T1, method = "pearson") #healthT2-positiveT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$health_mean_T2 and InputData$positive_mean_T1
## t = 6.376, df = 342, p-value = 5.89e-10
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2280661 0.4173051
## sample estimates:
##       cor 
## 0.3259468
cor.test(InputData$health_mean_T2, InputData$negative_mean_T1, method = "pearson") #healthT2-negativeT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$health_mean_T2 and InputData$negative_mean_T1
## t = -5.5936, df = 342, p-value = 4.559e-08
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.3835164 -0.1895785
## sample estimates:
##       cor 
## -0.289516
cor.test(InputData$health_mean_T2, InputData$environment_mean_T2, method = "pearson") #healthT2-envirionmentT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$health_mean_T2 and InputData$environment_mean_T2
## t = 6.3136, df = 342, p-value = 8.463e-10
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2250390 0.4146664
## sample estimates:
##       cor 
## 0.3230919
cor.test(InputData$health_mean_T2, InputData$bis_mean_T2, method = "pearson") #healthT2-bisT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$health_mean_T2 and InputData$bis_mean_T2
## t = -3.8763, df = 342, p-value = 0.0001271
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.3042904 -0.1016131
## sample estimates:
##        cor 
## -0.2051501
cor.test(InputData$health_mean_T2, InputData$bas_mean_T2, method = "pearson") #healthT2-basT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$health_mean_T2 and InputData$bas_mean_T2
## t = 7.2821, df = 342, p-value = 2.28e-12
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2711510 0.4545194
## sample estimates:
##       cor 
## 0.3663872
#相関表11列目
cor.test(InputData$positive_mean_T1, InputData$negative_mean_T1, method = "pearson") #positiveT1-negativeT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$positive_mean_T1 and InputData$negative_mean_T1
## t = -0.79847, df = 410, p-value = 0.4251
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.13549893  0.05742727
## sample estimates:
##         cor 
## -0.03940304
cor.test(InputData$positive_mean_T1, InputData$environment_mean_T2, method = "pearson") #positiveT1-envirionmentT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$positive_mean_T1 and InputData$environment_mean_T2
## t = 2.9931, df = 342, p-value = 0.002962
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.05495661 0.26109955
## sample estimates:
##       cor 
## 0.1597694
cor.test(InputData$positive_mean_T1, InputData$bis_mean_T2, method = "pearson") #positiveT1-bisT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$positive_mean_T1 and InputData$bis_mean_T2
## t = -2.0374, df = 342, p-value = 0.04238
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.212785501 -0.003811129
## sample estimates:
##        cor 
## -0.1095082
cor.test(InputData$positive_mean_T1, InputData$bas_mean_T2, method = "pearson") #positiveT1-basT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$positive_mean_T1 and InputData$bas_mean_T2
## t = 6.2745, df = 342, p-value = 1.061e-09
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2231361 0.4130061
## sample estimates:
##       cor 
## 0.3212965
#相関表12列目
cor.test(InputData$negative_mean_T1, InputData$environment_mean_T2, method = "pearson") #negativeT1-envirionmentT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$negative_mean_T1 and InputData$environment_mean_T2
## t = -1.148, df = 342, p-value = 0.2518
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.16660705  0.04407263
## sample estimates:
##         cor 
## -0.06195734
cor.test(InputData$negative_mean_T1, InputData$bis_mean_T2, method = "pearson") #negativeT1-bisT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$negative_mean_T1 and InputData$bis_mean_T2
## t = 4.4546, df = 342, p-value = 1.14e-05
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1316978 0.3317054
## sample estimates:
##       cor 
## 0.2341779
cor.test(InputData$negative_mean_T1, InputData$bas_mean_T2, method = "pearson") #negativeT1-basT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$negative_mean_T1 and InputData$bas_mean_T2
## t = -0.020087, df = 342, p-value = 0.984
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1068152  0.1046671
## sample estimates:
##          cor 
## -0.001086193
#相関表13列目
cor.test(InputData$environment_mean_T2, InputData$bis_mean_T2, method = "pearson") #environmentT2-bisT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$environment_mean_T2 and InputData$bis_mean_T2
## t = -2.4459, df = 342, p-value = 0.01495
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.23361857 -0.02573185
## sample estimates:
##        cor 
## -0.1311163
cor.test(InputData$environment_mean_T2, InputData$bas_mean_T2, method = "pearson") #environmentT2-basT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$environment_mean_T2 and InputData$bas_mean_T2
## t = 4.5889, df = 342, p-value = 6.264e-06
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1386269 0.3379721
## sample estimates:
##       cor 
## 0.2408378
#相関表14列目
cor.test(InputData$bis_mean_T2, InputData$bas_mean_T2, method = "pearson") #bisT2-basT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$bis_mean_T2 and InputData$bas_mean_T2
## t = 1.5444, df = 342, p-value = 0.1234
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.02271904  0.18731497
## sample estimates:
##        cor 
## 0.08322211

2-6. 相関係数の可視化(散布図)

library(GGally)
## 
## Attaching package: 'GGally'
## The following object is masked from 'package:dplyr':
## 
##     nasa
cordata <- InputData %>% #散布図用のデータセットcordata作成
  select(child_gender_T1, eoe_mean_T1:bas_mean_T2) %>% #性別とeoeからbasまでの列を抽出
  select(-na.rm) #na.rmという謎変数が含まれていたので除外
names(cordata) #変数名確認
##  [1] "child_gender_T1"     "eoe_mean_T1"         "eoe_mean_T2"        
##  [4] "lst_mean_T1"         "lst_mean_T2"         "aes_mean_T1"        
##  [7] "aes_mean_T2"         "hsc_mean_T1"         "hsc_mean_T2"        
## [10] "health_mean_T1"      "health_mean_T2"      "positive_mean_T1"   
## [13] "negative_mean_T1"    "environment_mean_T2" "bis_mean_T2"        
## [16] "bas_mean_T2"
# png("figure/corplot.png", width = 1200, height = 1200) #図の保存先指定
cor_plot <- ggpairs(cordata, mapping = aes(colour = factor(child_gender_T1), alpha=0.5)) #性別で色分けで作図
# dev.off() #保存
print(cor_plot) #出力

2-7. 欠損値分析

  • なぜかLittle’s MCAR関数がエラーでうごかないので、MANOVAで全2時点参加者と1時点だけ参加者の検定を行う。
# 欠損値分析に使う変数を抽出
x <- InputData %>% 
  select_("eoe_mean_T1", "lst_mean_T1", "aes_mean_T1", "health_mean_T1", "positive_mean_T1", "negative_mean_T1", "eoe_mean_T2")

#全時点参加者と1時点目だけ参加者のカテゴリ化変数を作成
x <- x %>% mutate(particitation = if_else(eoe_mean_T2 >=1, "1", "0")) #全時点参加者を0に置換する(2時点目の変数に回答しているということは全時点参加者なので)

#ここでT1だけの参加者を1にカテゴリ化
x <- x %>% select_("eoe_mean_T1", "lst_mean_T1", "aes_mean_T1", "health_mean_T1", "positive_mean_T1", "negative_mean_T1", "particitation")
x$particitation[is.na(x$particitation)] <- 0 #particitation列のNAを0に置換
names(x) #変数名確認
## [1] "eoe_mean_T1"      "lst_mean_T1"      "aes_mean_T1"     
## [4] "health_mean_T1"   "positive_mean_T1" "negative_mean_T1"
## [7] "particitation"
x$particitation #念のため列が1,0で置換されたか確認
##   [1] "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "0" "1" "1" "1"
##  [18] "1" "0" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "0" "1" "1" "1"
##  [35] "0" "1" "1" "0" "1" "1" "1" "1" "1" "0" "1" "1" "1" "1" "1" "1" "1"
##  [52] "1" "1" "1" "0" "1" "1" "0" "1" "1" "1" "0" "1" "1" "1" "1" "1" "1"
##  [69] "0" "1" "1" "1" "1" "1" "1" "1" "0" "1" "0" "1" "1" "1" "1" "1" "1"
##  [86] "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "0"
## [103] "1" "0" "1" "1" "0" "1" "1" "1" "0" "1" "1" "1" "1" "1" "0" "1" "1"
## [120] "0" "1" "0" "1" "1" "1" "0" "1" "1" "0" "0" "1" "1" "1" "1" "1" "1"
## [137] "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1"
## [154] "0" "1" "0" "1" "1" "1" "1" "1" "1" "1" "1" "0" "0" "1" "0" "1" "1"
## [171] "1" "1" "1" "1" "1" "1" "1" "1" "0" "1" "1" "1" "0" "1" "1" "1" "1"
## [188] "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1"
## [205] "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "0" "1" "1" "1" "1" "0"
## [222] "1" "1" "1" "1" "0" "1" "1" "1" "1" "1" "1" "1" "0" "1" "1" "1" "1"
## [239] "1" "1" "1" "1" "0" "0" "1" "1" "1" "0" "1" "0" "1" "0" "1" "1" "1"
## [256] "1" "1" "1" "1" "1" "1" "1" "0" "1" "1" "1" "1" "1" "1" "0" "1" "1"
## [273] "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "0" "0" "0" "1" "1" "0"
## [290] "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "0" "1" "1" "0"
## [307] "1" "1" "1" "1" "0" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1"
## [324] "1" "0" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1"
## [341] "1" "1" "0" "1" "1" "1" "1" "1" "0" "1" "1" "0" "1" "1" "1" "0" "0"
## [358] "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "0"
## [375] "1" "1" "0" "1" "1" "1" "0" "1" "1" "0" "0" "0" "1" "0" "1" "1" "1"
## [392] "1" "1" "1" "1" "1" "1" "1" "0" "0" "1" "1" "1" "1" "0" "1" "0" "0"
## [409] "1" "0" "0" "0"
x$particitation <- as.factor(x$particitation) #factor型に変換
class(x$particitation)
## [1] "factor"
head(x)
#particitationを独立変数としてMANOVA
result <- manova(cbind(eoe_mean_T1,lst_mean_T1,aes_mean_T1, health_mean_T1,positive_mean_T1, negative_mean_T1) ~ particitation, data = x)
summary(result) #出力
##                Df   Pillai approx F num Df den Df Pr(>F)
## particitation   1 0.010309  0.70314      6    405 0.6472
## Residuals     410
#結果メモ:従属変数間にparticipationの効果は見られなかった。

(3)因子分析

library(lavaan)
## This is lavaan 0.6-1
## lavaan is BETA software! Please report any bugs.
## 
## Attaching package: 'lavaan'
## The following object is masked from 'package:psych':
## 
##     cor2cov
library(semPlot)
library(semTools)
## 
## ###############################################################################
## This is semTools 0.5-0
## All users of R (or SEM) are invited to submit functions or ideas for functions.
## ###############################################################################
## 
## Attaching package: 'semTools'
## The following object is masked from 'package:psych':
## 
##     skew

3-1. HSCSの(縦断的)確認的因子分析

手順としては、(1)因子不変性の比較と最適なモデルの選択、(2)最適なモデルの適合度や因子負荷量や信頼性係数の算出

3-1-1. long型にデータ変換

#縦断的な測定不変性を検討するため、因子分析に用いるデータを【tidydata】型にする。
InputData_tidy <- InputData %>% 
  gather(key = "time", value = "hsc1", hsc1_T1, hsc1_T2) %>% 
  gather(key = "jikan1", value = "hsc2", hsc2_T1, hsc2_T2) %>% 
  gather(key = "jikan2", value = "hsc3", hsc3_T1, hsc3_T2) %>% 
  gather(key = "jikan3", value = "hsc4", hsc4_T1, hsc4_T2) %>% 
  gather(key = "jikan4", value = "hsc5", hsc5_T1, hsc5_T2) %>% 
  gather(key = "jikan5", value = "hsc6", hsc6_T1, hsc6_T2) %>% 
  gather(key = "jikan7", value = "hsc8", hsc8_T1, hsc8_T2) %>% 
  gather(key = "jikan8", value = "hsc9", hsc9_T1, hsc9_T2) %>% 
  gather(key = "jikan9", value = "hsc10", hsc10_T1, hsc10_T2) %>% 
  gather(key = "jikan10", value = "hsc11", hsc11_T1, hsc11_T2) %>% 
  gather(key = "jikan11", value = "hsc12", hsc12_T1, hsc12_T2)

InputData_tidy$time <- sub("hsc1_T", "", InputData_tidy$time) #time列のデータから"hsc_T1"文字を削除
InputData_tidy <- InputData_tidy %>% select(-starts_with("jikan")) #jikan列を削除
InputData_tidy$time <- as.numeric(InputData_tidy$time) #整数型に変換

names(InputData_tidy) #列名も確認
##   [1] "ID"                  "gardian_gender_T1"   "gardian_age_T1"     
##   [4] "prefecture_T1"       "area_T1"             "married_T1"         
##   [7] "familyincome_T1"     "pinincome_T1"        "job_T1"             
##  [10] "child_gender_T1"     "hsc7_T1"             "health1_T1"         
##  [13] "health2_T1"          "health3_T1"          "health4_T1"         
##  [16] "health5_T1"          "panas1_T1"           "panas2_T1"          
##  [19] "panas3_T1"           "panas4_T1"           "panas5_T1"          
##  [22] "panas6_T1"           "panas7_T1"           "panas8_T1"          
##  [25] "panas9_T1"           "panas10_T1"          "panas11_T1"         
##  [28] "panas12_T1"          "panas13_T1"          "panas14_T1"         
##  [31] "panas15_T1"          "panas16_T1"          "gardian_gender_T2"  
##  [34] "gardian_age_T2"      "prefecture_T2"       "area_T2"            
##  [37] "married_T2"          "familyincome_T2"     "pinincome_T2"       
##  [40] "job_T2"              "child_gender_T2"     "environment1_T2"    
##  [43] "environment2_T2"     "environment3_T2"     "environment4_T2"    
##  [46] "environment5_T2"     "environment6_T2"     "environment7_T2"    
##  [49] "environment8_T2"     "environment9_T2"     "environment10_T2"   
##  [52] "environment11_T2"    "hsc7_T2"             "health1_T2"         
##  [55] "health2_T2"          "health3_T2"          "health4_T2"         
##  [58] "health5_T2"          "bis1r_T2"            "bas1_T2"            
##  [61] "bas2_T2"             "bas3_T2"             "bas4_T2"            
##  [64] "bis2_T2"             "bas5_T2"             "bas6_T2"            
##  [67] "bas7_T2"             "bis3_T2"             "bas8_T2"            
##  [70] "bas9_T2"             "bis4_T2"             "bas10_T2"           
##  [73] "bis5_T2"             "bas11_T2"            "bas12_T2"           
##  [76] "bis6r_T2"            "bas13_T2"            "bis7_T2"            
##  [79] "bis1_T2"             "bis6_T2"             "eoe_mean_T1"        
##  [82] "na.rm"               "eoe_mean_T2"         "lst_mean_T1"        
##  [85] "lst_mean_T2"         "aes_mean_T1"         "aes_mean_T2"        
##  [88] "hsc_mean_T1"         "hsc_mean_T2"         "health_mean_T1"     
##  [91] "health_mean_T2"      "positive_mean_T1"    "negative_mean_T1"   
##  [94] "environment_mean_T2" "bis_mean_T2"         "bas_mean_T2"        
##  [97] "time"                "hsc1"                "hsc2"               
## [100] "hsc3"                "hsc4"                "hsc5"               
## [103] "hsc6"                "hsc8"                "hsc9"               
## [106] "hsc10"               "hsc11"               "hsc12"

3-1-2. モデル記述

model <-'
EOE =~ hsc4 + hsc6 + hsc8 + hsc9 + hsc12
LST =~ hsc2 + hsc11
AES =~ hsc1 + hsc3 + hsc5 + hsc10 
'

3-1-2. 配置不変から測定不変までのモデルを一気に比較してみる

  • semToolsパッケージが必要。
  • tidydataで行数多いので推定に時間かかる。
  • 等値制約が少ないモデルと多いモデルのχ2を比較して、p値が有意(χ2値が悪化:増加)であれば等値制約が少ないほうのモデルを採用。p値が有意であれば多いほうのモデルを採用。
  • 比較結果をみると、配置不変モデルが最も適合度がよいモデルであることがわかる。
measurementInvariance(model = model, data = InputData_tidy, std.lv = TRUE, strict = TRUE, fit.measures = c("cfi", "rmsea", "aic"), group= "time", missing = "fiml") #ものすごく推定時間かかる
## 
## Measurement invariance models:
## 
## Model 1 : fit.configural
## Model 2 : fit.loadings
## Model 3 : fit.intercepts
## Model 4 : fit.residuals
## Model 5 : fit.means
## 
## Chi Square Difference Test
## 
##                 Df      AIC      BIC  Chisq Chisq diff Df diff Pr(>Chisq)
## fit.configural  82 27636382 27637221 142144                              
## fit.loadings    90 27639691 27640436 145469     3324.4       8     <2e-16
## fit.intercepts  98 27640272 27640924 146066      597.1       8     <2e-16
## fit.residuals  109 27647115 27647639 152931     6865.6      11     <2e-16
## fit.means      112 27647114 27647603 152936        5.0       3     0.1722
##                   
## fit.configural    
## fit.loadings   ***
## fit.intercepts ***
## fit.residuals  ***
## fit.means         
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Fit measures:
## 
##                  cfi rmsea      aic cfi.delta rmsea.delta aic.delta
## fit.configural 0.894 0.064 27636382        NA          NA        NA
## fit.loadings   0.892 0.062 27639691     0.002       0.002  3308.355
## fit.intercepts 0.891 0.059 27640272     0.000       0.002   581.125
## fit.residuals  0.886 0.058 27647115     0.005       0.002  6843.596
## fit.means      0.886 0.057 27647114     0.000       0.001     1.005

3-1-3. 配置不変モデルの確認的因子分析

  • 結果メモ:適合度は良好
config <- cfa(model, data = InputData_tidy, group = "time", missing = "fiml")
summary(config, fit.measures = TRUE, standardized = TRUE) #列が長いから結構推定時間長くかかる
## lavaan (0.6-1) converged normally after 117 iterations
## 
##   Number of observations per group         
##   1                                             421888
##   2                                             421820
##   Number of missing patterns per group     
##   1                                               1024
##   2                                               1024
## 
##   Estimator                                         ML
##   Model Fit Test Statistic                  142144.379
##   Degrees of freedom                                82
##   P-value (Chi-square)                           0.000
## 
## Chi-square for each group:
## 
##   1                                          77668.814
##   2                                          64475.564
## 
## Model test baseline model:
## 
##   Minimum Function Test Statistic           1342268.910
##   Degrees of freedom                               110
##   P-value                                        0.000
## 
## User model versus baseline model:
## 
##   Comparative Fit Index (CFI)                    0.894
##   Tucker-Lewis Index (TLI)                       0.858
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)             -13818119.123
##   Loglikelihood unrestricted model (H1)     -13747046.934
## 
##   Number of free parameters                         72
##   Akaike (AIC)                              27636382.246
##   Bayesian (BIC)                            27637220.726
##   Sample-size adjusted Bayesian (BIC)       27636991.907
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.064
##   90 Percent Confidence Interval          0.064  0.064
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.043
## 
## Parameter Estimates:
## 
##   Information                                 Observed
##   Observed information based on                Hessian
##   Standard Errors                             Standard
## 
## 
## Group 1 [1]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   EOE =~                                                                
##     hsc4              1.000                               0.715    0.528
##     hsc6              1.223    0.005  249.271    0.000    0.874    0.669
##     hsc8              1.140    0.005  251.984    0.000    0.815    0.654
##     hsc9              0.671    0.004  183.666    0.000    0.480    0.403
##     hsc12             1.126    0.005  241.538    0.000    0.805    0.609
##   LST =~                                                                
##     hsc2              1.000                               0.848    0.603
##     hsc11             0.919    0.005  193.522    0.000    0.779    0.580
##   AES =~                                                                
##     hsc1              1.000                               0.404    0.324
##     hsc3              1.655    0.011  145.943    0.000    0.668    0.493
##     hsc5              2.496    0.016  159.590    0.000    1.008    0.695
##     hsc10             2.236    0.015  151.911    0.000    0.903    0.644
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   EOE ~~                                                                
##     LST               0.440    0.002  177.554    0.000    0.725    0.725
##     AES               0.099    0.001  108.280    0.000    0.343    0.343
##   LST ~~                                                                
##     AES               0.081    0.001   72.783    0.000    0.236    0.236
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .hsc4              4.191    0.002 1939.280    0.000    4.191    3.097
##    .hsc6              4.808    0.002 2310.496    0.000    4.808    3.677
##    .hsc8              4.441    0.002 2237.092    0.000    4.441    3.562
##    .hsc9              4.135    0.002 2171.329    0.000    4.135    3.476
##    .hsc12             4.584    0.002 2175.437    0.000    4.584    3.467
##    .hsc2              4.093    0.002 1820.420    0.000    4.093    2.909
##    .hsc11             4.616    0.002 2148.252    0.000    4.616    3.434
##    .hsc1              4.243    0.002 2214.998    0.000    4.243    3.410
##    .hsc3              4.698    0.002 2167.556    0.000    4.698    3.468
##    .hsc5              5.225    0.002 2260.766    0.000    5.225    3.606
##    .hsc10             5.590    0.002 2497.529    0.000    5.590    3.986
##     EOE               0.000                               0.000    0.000
##     LST               0.000                               0.000    0.000
##     AES               0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .hsc4              1.321    0.003  379.102    0.000    1.321    0.721
##    .hsc6              0.946    0.003  313.816    0.000    0.946    0.553
##    .hsc8              0.891    0.003  326.221    0.000    0.891    0.573
##    .hsc9              1.185    0.003  409.086    0.000    1.185    0.837
##    .hsc12             1.100    0.003  346.993    0.000    1.100    0.630
##    .hsc2              1.260    0.005  269.468    0.000    1.260    0.636
##    .hsc11             1.199    0.004  290.004    0.000    1.199    0.664
##    .hsc1              1.385    0.003  429.612    0.000    1.385    0.895
##    .hsc3              1.389    0.004  367.009    0.000    1.389    0.757
##    .hsc5              1.084    0.005  224.187    0.000    1.084    0.516
##    .hsc10             1.152    0.004  269.118    0.000    1.152    0.586
##     EOE               0.511    0.003  149.425    0.000    1.000    1.000
##     LST               0.720    0.005  140.884    0.000    1.000    1.000
##     AES               0.163    0.002   86.312    0.000    1.000    1.000
## 
## 
## Group 2 [2]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   EOE =~                                                                
##     hsc4              1.000                               0.714    0.528
##     hsc6              1.225    0.005  249.485    0.000    0.875    0.669
##     hsc8              1.142    0.005  252.176    0.000    0.816    0.654
##     hsc9              0.671    0.004  183.604    0.000    0.479    0.403
##     hsc12             1.124    0.005  241.525    0.000    0.803    0.607
##   LST =~                                                                
##     hsc2              1.000                               0.849    0.604
##     hsc11             0.916    0.005  192.540    0.000    0.778    0.579
##   AES =~                                                                
##     hsc1              1.000                               0.216    0.203
##     hsc3              3.159    0.034   93.355    0.000    0.681    0.503
##     hsc5              4.586    0.048   95.364    0.000    0.989    0.683
##     hsc10             4.224    0.046   91.761    0.000    0.911    0.650
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   EOE ~~                                                                
##     LST               0.440    0.002  177.482    0.000    0.725    0.725
##     AES               0.053    0.001   80.084    0.000    0.344    0.344
##   LST ~~                                                                
##     AES               0.037    0.001   56.977    0.000    0.203    0.203
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .hsc4              4.192    0.002 1939.504    0.000    4.192    3.097
##    .hsc6              4.809    0.002 2310.847    0.000    4.809    3.678
##    .hsc8              4.442    0.002 2237.419    0.000    4.442    3.562
##    .hsc9              4.136    0.002 2171.451    0.000    4.136    3.477
##    .hsc12             4.584    0.002 2175.709    0.000    4.584    3.468
##    .hsc2              4.093    0.002 1820.474    0.000    4.093    2.909
##    .hsc11             4.616    0.002 2148.272    0.000    4.616    3.434
##    .hsc1              4.180    0.002 2336.452    0.000    4.180    3.930
##    .hsc3              4.699    0.002 2167.811    0.000    4.699    3.469
##    .hsc5              5.227    0.002 2259.724    0.000    5.227    3.608
##    .hsc10             5.592    0.002 2496.739    0.000    5.592    3.988
##     EOE               0.000                               0.000    0.000
##     LST               0.000                               0.000    0.000
##     AES               0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .hsc4              1.321    0.003  379.315    0.000    1.321    0.721
##    .hsc6              0.944    0.003  313.674    0.000    0.944    0.552
##    .hsc8              0.889    0.003  326.253    0.000    0.889    0.572
##    .hsc9              1.185    0.003  409.231    0.000    1.185    0.838
##    .hsc12             1.103    0.003  347.787    0.000    1.103    0.631
##    .hsc2              1.258    0.005  267.996    0.000    1.258    0.636
##    .hsc11             1.201    0.004  289.765    0.000    1.201    0.665
##    .hsc1              1.085    0.003  410.472    0.000    1.085    0.959
##    .hsc3              1.370    0.004  358.122    0.000    1.370    0.747
##    .hsc5              1.120    0.005  226.285    0.000    1.120    0.534
##    .hsc10             1.136    0.004  255.347    0.000    1.136    0.578
##     EOE               0.510    0.003  149.423    0.000    1.000    1.000
##     LST               0.721    0.005  140.585    0.000    1.000    1.000
##     AES               0.047    0.001   48.676    0.000    1.000    1.000
cfa.config.plot <- semPaths(config, "std", edge.label.cex=.8, fade = FALSE, gray = TRUE, mar=c(6,1,3,1), style="lisrel") #作図

3-2. 学校環境変化尺度の探索的因子分析

分析の手順としては、(1)因子数の決定、(2)それにもとづく回転と因子負荷量の推定、(3)信頼性係数の算出、(4)再度合計得点の算出と列追加

library(psych)
library(MASS)
## 
## Attaching package: 'MASS'
## The following object is masked from 'package:dplyr':
## 
##     select
library(GPArotation)
#因子分析用データセットの作成
library(tidyverse)
environment.data <- InputData[, 53:63] #なぜかdplyr::selectがつかえない…
names(environment.data) #変数名確認
##  [1] "environment1_T2"  "environment2_T2"  "environment3_T2" 
##  [4] "environment4_T2"  "environment5_T2"  "environment6_T2" 
##  [7] "environment7_T2"  "environment8_T2"  "environment9_T2" 
## [10] "environment10_T2" "environment11_T2"

3-2-1. 平行分析(因子数の決定)

結果メモ:4因子解が推奨された

fa.parallel(environment.data, fm = "ml", fa = "fa") #fm =最尤法推定, fa=主因子法抽出

## Parallel analysis suggests that the number of factors =  5  and the number of components =  NA

3-2-2. MAPテスト(因子数の決定)

  • 結果メモ:1因子解が推奨された
VSS(environment.data, n = 10) #n = 10因子までの数値を算出

## 
## Very Simple Structure
## Call: vss(x = x, n = n, rotate = rotate, diagonal = diagonal, fm = fm, 
##     n.obs = n.obs, plot = plot, title = title, use = use, cor = cor)
## VSS complexity 1 achieves a maximimum of 0.81  with  2  factors
## VSS complexity 2 achieves a maximimum of 0.91  with  3  factors
## 
## The Velicer MAP achieves a minimum of 0.06  with  1  factors 
## BIC achieves a minimum of  NA  with  4  factors
## Sample Size adjusted BIC achieves a minimum of  NA  with  4  factors
## 
## Statistics by number of factors 
##    vss1 vss2   map dof   chisq     prob sqresid  fit RMSEA BIC SABIC
## 1  0.77 0.00 0.056  44 9.2e+02 2.2e-164    6.62 0.77 0.222 656   795
## 2  0.81 0.87 0.065  34 4.7e+02  6.7e-79    3.81 0.87 0.179 269   377
## 3  0.80 0.91 0.060  25 2.1e+02  9.1e-32    1.97 0.93 0.137  63   142
## 4  0.63 0.88 0.066  17 2.1e+01  2.5e-01    1.41 0.95 0.024 -82   -28
## 5  0.62 0.86 0.101  10 6.7e+00  7.5e-01    1.22 0.96 0.000 -53   -22
## 6  0.63 0.85 0.141   4 8.8e-01  9.3e-01    1.23 0.96 0.000 -23   -11
## 7  0.59 0.82 0.203  -1 2.2e-02       NA    0.98 0.97    NA  NA    NA
## 8  0.63 0.85 0.318  -5 5.3e-05       NA    0.95 0.97    NA  NA    NA
## 9  0.63 0.85 0.493  -8 3.8e-08       NA    1.02 0.97    NA  NA    NA
## 10 0.63 0.85 1.000 -10 0.0e+00       NA    1.01 0.97    NA  NA    NA
##    complex  eChisq    SRMR  eCRMS eBIC
## 1      1.0 8.4e+02 1.4e-01 0.1524  577
## 2      1.2 3.4e+02 8.7e-02 0.1107  139
## 3      1.2 7.6e+01 4.1e-02 0.0608  -74
## 4      1.4 5.7e+00 1.1e-02 0.0202  -97
## 5      1.6 1.2e+00 5.2e-03 0.0121  -59
## 6      1.6 1.8e-01 2.0e-03 0.0074  -24
## 7      1.7 2.0e-03 2.1e-04     NA   NA
## 8      1.7 5.1e-06 1.1e-05     NA   NA
## 9      1.7 5.5e-09 3.5e-07     NA   NA
## 10     1.7 1.1e-14 5.0e-10     NA   NA

3-2-3. 4因子解の探索的因子分析

  • 結果メモ:項目1-2,3-4といった項目順で因子が構成されてしまっている。因子負荷は十分だが、1を超えるものもある。1因子2項目ずつでは少ないし、結果が頑健でなくなるかも。
  • 結果メモ:1因子解を採用した方がよさそう。
factor4 <- fa(environment.data, nfactors = 4, rotate = "promax", fm = "ml", scores = TRUE)
print(factor4, sort = TRUE)
## Factor Analysis using method =  ml
## Call: fa(r = environment.data, nfactors = 4, rotate = "promax", scores = TRUE, 
##     fm = "ml")
## 
##  Warning: A Heywood case was detected. 
## Standardized loadings (pattern matrix) based upon correlation matrix
##                  item   ML2   ML1   ML3   ML4   h2    u2 com
## environment2_T2     2  1.06 -0.06 -0.11 -0.09 0.87 0.126 1.0
## environment1_T2     1  0.97 -0.09 -0.10 -0.06 0.72 0.276 1.0
## environment6_T2     6  0.71  0.06  0.06  0.01 0.60 0.399 1.0
## environment5_T2     5  0.56 -0.04  0.12  0.11 0.49 0.515 1.2
## environment11_T2   11  0.39  0.16  0.08  0.06 0.31 0.691 1.5
## environment10_T2   10 -0.01  1.02 -0.03 -0.06 0.98 0.020 1.0
## environment9_T2     9 -0.04  0.83 -0.02  0.02 0.67 0.328 1.0
## environment4_T2     4 -0.08 -0.04  1.03 -0.03 0.92 0.078 1.0
## environment3_T2     3  0.23 -0.01  0.65 -0.02 0.66 0.336 1.3
## environment8_T2     8  0.06 -0.02 -0.10  0.91 0.78 0.216 1.0
## environment7_T2     7 -0.09 -0.01  0.05  0.79 0.60 0.396 1.0
## 
##                        ML2  ML1  ML3  ML4
## SS loadings           3.02 1.69 1.49 1.41
## Proportion Var        0.27 0.15 0.14 0.13
## Cumulative Var        0.27 0.43 0.56 0.69
## Proportion Explained  0.40 0.22 0.20 0.18
## Cumulative Proportion 0.40 0.62 0.82 1.00
## 
##  With factor correlations of 
##      ML2  ML1  ML3  ML4
## ML2 1.00 0.37 0.71 0.43
## ML1 0.37 1.00 0.25 0.30
## ML3 0.71 0.25 1.00 0.44
## ML4 0.43 0.30 0.44 1.00
## 
## Mean item complexity =  1.1
## Test of the hypothesis that 4 factors are sufficient.
## 
## The degrees of freedom for the null model are  55  and the objective function was  6.05 with Chi Square of  2459.95
## The degrees of freedom for the model are 17  and the objective function was  0.05 
## 
## The root mean square of the residuals (RMSR) is  0.01 
## The df corrected root mean square of the residuals is  0.02 
## 
## The harmonic number of observations is  344 with the empirical chi square  5.4  with prob <  1 
## The total number of observations was  412  with Likelihood Chi Square =  19.22  with prob <  0.32 
## 
## Tucker Lewis Index of factoring reliability =  0.997
## RMSEA index =  0.019  and the 90 % confidence intervals are  0 0.05
## BIC =  -83.14
## Fit based upon off diagonal values = 1
## Measures of factor score adequacy             
##                                                    ML2  ML1  ML3  ML4
## Correlation of (regression) scores with factors   0.97 0.99 0.97 0.92
## Multiple R square of scores with factors          0.94 0.98 0.94 0.85
## Minimum correlation of possible factor scores     0.88 0.96 0.88 0.70

3-2-4. 1因子解の因子分析(1回目)

  • 結果メモ:項目7,9,10の負荷量が0.35以下と低い。これらを削除して、再度因子分析をする。
factor1 <- fa(environment.data, nfactors = 1, rotate = "none", fm = "ml", scores = TRUE)
print(factor1, sort = TRUE) #結果出力
## Factor Analysis using method =  ml
## Call: fa(r = environment.data, nfactors = 1, rotate = "none", scores = TRUE, 
##     fm = "ml")
## Standardized loadings (pattern matrix) based upon correlation matrix
##                   V  ML1    h2   u2 com
## environment2_T2   2 0.87 0.759 0.24   1
## environment1_T2   1 0.81 0.659 0.34   1
## environment6_T2   6 0.79 0.628 0.37   1
## environment3_T2   3 0.72 0.512 0.49   1
## environment5_T2   5 0.71 0.498 0.50   1
## environment4_T2   4 0.67 0.447 0.55   1
## environment11_T2 11 0.54 0.296 0.70   1
## environment8_T2   8 0.38 0.144 0.86   1
## environment7_T2   7 0.31 0.098 0.90   1
## environment10_T2 10 0.31 0.096 0.90   1
## environment9_T2   9 0.26 0.069 0.93   1
## 
##                 ML1
## SS loadings    4.21
## Proportion Var 0.38
## 
## Mean item complexity =  1
## Test of the hypothesis that 1 factor is sufficient.
## 
## The degrees of freedom for the null model are  55  and the objective function was  6.05 with Chi Square of  2459.95
## The degrees of freedom for the model are 44  and the objective function was  2.22 
## 
## The root mean square of the residuals (RMSR) is  0.14 
## The df corrected root mean square of the residuals is  0.16 
## 
## The harmonic number of observations is  344 with the empirical chi square  749.35  with prob <  4.4e-129 
## The total number of observations was  412  with Likelihood Chi Square =  902.78  with prob <  1.1e-160 
## 
## Tucker Lewis Index of factoring reliability =  0.553
## RMSEA index =  0.219  and the 90 % confidence intervals are  0.206 0.23
## BIC =  637.85
## Fit based upon off diagonal values = 0.88
## Measures of factor score adequacy             
##                                                    ML1
## Correlation of (regression) scores with factors   0.96
## Multiple R square of scores with factors          0.91
## Minimum correlation of possible factor scores     0.83

3-2-5. 1因子解の因子分析(2回目, 項目7,9,10削除)

  • 結果メモ:項目8が因子負荷0.35でまあギリギリ。これで確定とする。
#項目7,9,10削除データ作成
environment.data.2 <- environment.data %>% select_("environment1_T2","environment2_T2", "environment3_T2", "environment4_T2", "environment5_T2", "environment6_T2", "environment8_T2", "environment11_T2")
names(environment.data.2) #変数名確認
## [1] "environment1_T2"  "environment2_T2"  "environment3_T2" 
## [4] "environment4_T2"  "environment5_T2"  "environment6_T2" 
## [7] "environment8_T2"  "environment11_T2"
#再度因子分析
factor1.second <- fa(environment.data.2, nfactors = 1, rotate = "none", fm = "ml", scores = TRUE)
print(factor1.second, sort = TRUE) #結果出力
## Factor Analysis using method =  ml
## Call: fa(r = environment.data.2, nfactors = 1, rotate = "none", scores = TRUE, 
##     fm = "ml")
## Standardized loadings (pattern matrix) based upon correlation matrix
##                  V  ML1   h2   u2 com
## environment2_T2  2 0.89 0.78 0.22   1
## environment1_T2  1 0.83 0.68 0.32   1
## environment6_T2  6 0.79 0.62 0.38   1
## environment3_T2  3 0.71 0.51 0.49   1
## environment5_T2  5 0.70 0.49 0.51   1
## environment4_T2  4 0.66 0.44 0.56   1
## environment11_T2 8 0.53 0.28 0.72   1
## environment8_T2  7 0.35 0.12 0.88   1
## 
##                 ML1
## SS loadings    3.92
## Proportion Var 0.49
## 
## Mean item complexity =  1
## Test of the hypothesis that 1 factor is sufficient.
## 
## The degrees of freedom for the null model are  28  and the objective function was  4.15 with Chi Square of  1692.9
## The degrees of freedom for the model are 20  and the objective function was  0.56 
## 
## The root mean square of the residuals (RMSR) is  0.07 
## The df corrected root mean square of the residuals is  0.08 
## 
## The harmonic number of observations is  344 with the empirical chi square  89.27  with prob <  1e-10 
## The total number of observations was  412  with Likelihood Chi Square =  226.85  with prob <  5.1e-37 
## 
## Tucker Lewis Index of factoring reliability =  0.826
## RMSEA index =  0.16  and the 90 % confidence intervals are  0.14 0.178
## BIC =  106.43
## Fit based upon off diagonal values = 0.98
## Measures of factor score adequacy             
##                                                    ML1
## Correlation of (regression) scores with factors   0.96
## Multiple R square of scores with factors          0.91
## Minimum correlation of possible factor scores     0.83

3-2-6. 学校環境変化尺度の信頼性係数の算出

  • 結果メモ:alpha=0.88で十分、omegatotal=0.91
omega(environment.data.2,3, fm = "ml") #算出

## Omega 
## Call: omega(m = environment.data.2, nfactors = 3, fm = "ml")
## Alpha:                 0.88 
## G.6:                   0.89 
## Omega Hierarchical:    0.77 
## Omega H asymptotic:    0.85 
## Omega Total            0.91 
## 
## Schmid Leiman Factor loadings greater than  0.2 
##                     g   F1*  F2*   F3*   h2   u2   p2
## environment1_T2  0.75  0.41            0.73 0.27 0.76
## environment2_T2  0.83  0.44            0.88 0.12 0.78
## environment3_T2  0.70       0.71       1.00 0.00 0.49
## environment4_T2  0.63       0.45       0.62 0.38 0.64
## environment5_T2  0.69             0.38 0.62 0.38 0.76
## environment6_T2  0.73  0.22            0.62 0.38 0.86
## environment8_T2  0.35             0.27 0.20 0.80 0.59
## environment11_T2 0.49                  0.28 0.72 0.86
## 
## With eigenvalues of:
##    g  F1*  F2*  F3* 
## 3.48 0.44 0.73 0.29 
## 
## general/max  4.8   max/min =   2.53
## mean percent general =  0.72    with sd =  0.13 and cv of  0.18 
## Explained Common Variance of the general factor =  0.71 
## 
## The degrees of freedom are 7  and the fit is  0.01 
## The number of observations was  412  with Chi Square =  5.83  with prob <  0.56
## The root mean square of the residuals is  0.01 
## The df corrected root mean square of the residuals is  0.03
## RMSEA index =  0  and the 10 % confidence intervals are  0 0.054
## BIC =  -36.32
## 
## Compare this with the adequacy of just a general factor and no group factors
## The degrees of freedom for just the general factor are 20  and the fit is  0.65 
## The number of observations was  412  with Chi Square =  264.25  with prob <  1.5e-44
## The root mean square of the residuals is  0.09 
## The df corrected root mean square of the residuals is  0.1 
## 
## RMSEA index =  0.173  and the 10 % confidence intervals are  0.154 0.191
## BIC =  143.83 
## 
## Measures of factor score adequacy             
##                                                  g   F1*  F2*   F3*
## Correlation of scores with factors            0.90  0.60 0.90  0.58
## Multiple R square of scores with factors      0.81  0.36 0.81  0.33
## Minimum correlation of factor score estimates 0.62 -0.29 0.61 -0.34
## 
##  Total, General and Subset omega for each subset
##                                                  g  F1*  F2*  F3*
## Omega total for total scores and subscales    0.91 0.85 0.89 0.56
## Omega general for total scores and subscales  0.77 0.72 0.50 0.40
## Omega group for total scores and subscales    0.09 0.13 0.38 0.16

3-2-7. 学校環境尺度の最終的な合計点を再度算出し、InputDataに列追加

InputData <- InputData %>% 
  dplyr::mutate(environment_mean_afterEFA_T2 = (environment1_T2 + environment2_T2 + environment3_T2 + environment4_T2 + environment5_T2 + environment6_T2 + environment8_T2 + environment11_T2)/8, na.rm = TRUE)
names(InputData) #合計得点追加されたか確認
##   [1] "ID"                           "gardian_gender_T1"           
##   [3] "gardian_age_T1"               "prefecture_T1"               
##   [5] "area_T1"                      "married_T1"                  
##   [7] "familyincome_T1"              "pinincome_T1"                
##   [9] "job_T1"                       "child_gender_T1"             
##  [11] "hsc1_T1"                      "hsc2_T1"                     
##  [13] "hsc3_T1"                      "hsc4_T1"                     
##  [15] "hsc5_T1"                      "hsc6_T1"                     
##  [17] "hsc7_T1"                      "hsc8_T1"                     
##  [19] "hsc9_T1"                      "hsc10_T1"                    
##  [21] "hsc11_T1"                     "hsc12_T1"                    
##  [23] "health1_T1"                   "health2_T1"                  
##  [25] "health3_T1"                   "health4_T1"                  
##  [27] "health5_T1"                   "panas1_T1"                   
##  [29] "panas2_T1"                    "panas3_T1"                   
##  [31] "panas4_T1"                    "panas5_T1"                   
##  [33] "panas6_T1"                    "panas7_T1"                   
##  [35] "panas8_T1"                    "panas9_T1"                   
##  [37] "panas10_T1"                   "panas11_T1"                  
##  [39] "panas12_T1"                   "panas13_T1"                  
##  [41] "panas14_T1"                   "panas15_T1"                  
##  [43] "panas16_T1"                   "gardian_gender_T2"           
##  [45] "gardian_age_T2"               "prefecture_T2"               
##  [47] "area_T2"                      "married_T2"                  
##  [49] "familyincome_T2"              "pinincome_T2"                
##  [51] "job_T2"                       "child_gender_T2"             
##  [53] "environment1_T2"              "environment2_T2"             
##  [55] "environment3_T2"              "environment4_T2"             
##  [57] "environment5_T2"              "environment6_T2"             
##  [59] "environment7_T2"              "environment8_T2"             
##  [61] "environment9_T2"              "environment10_T2"            
##  [63] "environment11_T2"             "hsc1_T2"                     
##  [65] "hsc2_T2"                      "hsc3_T2"                     
##  [67] "hsc4_T2"                      "hsc5_T2"                     
##  [69] "hsc6_T2"                      "hsc7_T2"                     
##  [71] "hsc8_T2"                      "hsc9_T2"                     
##  [73] "hsc10_T2"                     "hsc11_T2"                    
##  [75] "hsc12_T2"                     "health1_T2"                  
##  [77] "health2_T2"                   "health3_T2"                  
##  [79] "health4_T2"                   "health5_T2"                  
##  [81] "bis1r_T2"                     "bas1_T2"                     
##  [83] "bas2_T2"                      "bas3_T2"                     
##  [85] "bas4_T2"                      "bis2_T2"                     
##  [87] "bas5_T2"                      "bas6_T2"                     
##  [89] "bas7_T2"                      "bis3_T2"                     
##  [91] "bas8_T2"                      "bas9_T2"                     
##  [93] "bis4_T2"                      "bas10_T2"                    
##  [95] "bis5_T2"                      "bas11_T2"                    
##  [97] "bas12_T2"                     "bis6r_T2"                    
##  [99] "bas13_T2"                     "bis7_T2"                     
## [101] "bis1_T2"                      "bis6_T2"                     
## [103] "eoe_mean_T1"                  "na.rm"                       
## [105] "eoe_mean_T2"                  "lst_mean_T1"                 
## [107] "lst_mean_T2"                  "aes_mean_T1"                 
## [109] "aes_mean_T2"                  "hsc_mean_T1"                 
## [111] "hsc_mean_T2"                  "health_mean_T1"              
## [113] "health_mean_T2"               "positive_mean_T1"            
## [115] "negative_mean_T1"             "environment_mean_T2"         
## [117] "bis_mean_T2"                  "bas_mean_T2"                 
## [119] "environment_mean_afterEFA_T2"

3-2-8. 因子分析後の学校環境変化尺度の度数分布

environment_mean_afterEFA_T2_count <- dplyr::count(InputData, environment_mean_afterEFA_T2)
knitr::kable(environment_mean_afterEFA_T2_count, digits = 2) #テーブル化
environment_mean_afterEFA_T2 n
1.00 1
1.38 1
2.62 3
2.75 1
3.00 3
3.12 1
3.25 9
3.38 4
3.50 6
3.62 11
3.75 13
3.88 21
4.00 36
4.12 26
4.25 27
4.38 19
4.50 9
4.62 24
4.75 20
4.88 14
5.00 10
5.12 14
5.25 7
5.38 8
5.50 9
5.62 7
5.75 7
5.88 5
6.00 5
6.12 7
6.25 6
6.38 3
6.50 2
6.62 1
6.75 1
7.00 3
NA 68
ggplot(data = InputData, mapping = aes(x = environment_mean_afterEFA_T2, fill = factor(environment_mean_afterEFA_T2))) + 
  geom_histogram(binwidth = 0.2) + 
  guides(fill = "none") #視覚化

3-2-9. 因子分析後の学校環境変化尺度の基礎統計量

environment_mean_afterEFA_T2_discriptive <- 
  InputData %>% 
  select_("environment_mean_afterEFA_T2") %>%
  drop_na() %>%
  dplyr::summarise(n = n (), #グループの人数を出力
                   environment.mean = mean (environment_mean_afterEFA_T2), #environment_mean_afterEFA_T2の平均
                   environment.sd = sd (environment_mean_afterEFA_T2)) #environment_mean_afterEFA_T2のSD
environment_mean_afterEFA_T2_discriptive  #出力                 

3-2-10. 確定した学校環境変化尺度と他の変数の相関

cor.test(InputData$environment_mean_afterEFA_T2, InputData$hsc_mean_T1, method = "pearson") #hscT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$environment_mean_afterEFA_T2 and InputData$hsc_mean_T1
## t = 0.65783, df = 342, p-value = 0.5111
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.07045709  0.14076110
## sample estimates:
##        cor 
## 0.03554899
cor.test(InputData$environment_mean_afterEFA_T2, InputData$hsc_mean_T2, method = "pearson") #hscT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$environment_mean_afterEFA_T2 and InputData$hsc_mean_T2
## t = 1.3102, df = 342, p-value = 0.191
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.03533566  0.17510237
## sample estimates:
##        cor 
## 0.07066962
cor.test(InputData$environment_mean_afterEFA_T2, InputData$eoe_mean_T1, method = "pearson") #eoeT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$environment_mean_afterEFA_T2 and InputData$eoe_mean_T1
## t = -1.0814, df = 342, p-value = 0.2803
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.16310927  0.04766057
## sample estimates:
##         cor 
## -0.05837485
cor.test(InputData$environment_mean_afterEFA_T2, InputData$eoe_mean_T2, method = "pearson") #eoeT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$environment_mean_afterEFA_T2 and InputData$eoe_mean_T2
## t = -1.2428, df = 342, p-value = 0.2148
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.17157569  0.03896656
## sample estimates:
##         cor 
## -0.06705094
cor.test(InputData$environment_mean_afterEFA_T2, InputData$lst_mean_T1, method = "pearson") #lstT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$environment_mean_afterEFA_T2 and InputData$lst_mean_T1
## t = 0.0026645, df = 342, p-value = 0.9979
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1055988  0.1058837
## sample estimates:
##          cor 
## 0.0001440796
cor.test(InputData$environment_mean_afterEFA_T2, InputData$lst_mean_T2, method = "pearson") #lstT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$environment_mean_afterEFA_T2 and InputData$lst_mean_T2
## t = -0.59664, df = 342, p-value = 0.5511
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.13751797  0.07374705
## sample estimates:
##         cor 
## -0.03224564
cor.test(InputData$environment_mean_afterEFA_T2, InputData$aes_mean_T1, method = "pearson") #aesT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$environment_mean_afterEFA_T2 and InputData$aes_mean_T1
## t = 2.5117, df = 342, p-value = 0.01247
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.02925753 0.23695160
## sample estimates:
##       cor 
## 0.1345824
cor.test(InputData$environment_mean_afterEFA_T2, InputData$aes_mean_T2, method = "pearson") #aesT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$environment_mean_afterEFA_T2 and InputData$aes_mean_T2
## t = 5.3356, df = 342, p-value = 1.737e-07
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1766461 0.3720451
## sample estimates:
##       cor 
## 0.2772094
cor.test(InputData$environment_mean_afterEFA_T2, InputData$health_mean_T1, method = "pearson") #healthT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$environment_mean_afterEFA_T2 and InputData$health_mean_T1
## t = 0.264, df = 342, p-value = 0.7919
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.09160556  0.11983429
## sample estimates:
##        cor 
## 0.01427393
cor.test(InputData$environment_mean_afterEFA_T2, InputData$health_mean_T2, method = "pearson") #healthT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$environment_mean_afterEFA_T2 and InputData$health_mean_T2
## t = 6.1096, df = 342, p-value = 2.718e-09
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2150864 0.4059683
## sample estimates:
##       cor 
## 0.3136932
cor.test(InputData$environment_mean_afterEFA_T2, InputData$positive_mean_T1, method = "pearson") #positiveT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$environment_mean_afterEFA_T2 and InputData$positive_mean_T1
## t = 2.6607, df = 342, p-value = 0.008166
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.03722533 0.24446603
## sample estimates:
##      cor 
## 0.142406
cor.test(InputData$environment_mean_afterEFA_T2, InputData$negative_mean_T1, method = "pearson") #negativeT1の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$environment_mean_afterEFA_T2 and InputData$negative_mean_T1
## t = -1.1513, df = 342, p-value = 0.2504
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.16678168  0.04389336
## sample estimates:
##         cor 
## -0.06213627
cor.test(InputData$environment_mean_afterEFA_T2, InputData$bis_mean_T2, method = "pearson") #bisT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$environment_mean_afterEFA_T2 and InputData$bis_mean_T2
## t = -2.1718, df = 342, p-value = 0.03056
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.21966912 -0.01103197
## sample estimates:
##        cor 
## -0.1166371
cor.test(InputData$environment_mean_afterEFA_T2, InputData$bas_mean_T2, method = "pearson") #basT2の相関
## 
##  Pearson's product-moment correlation
## 
## data:  InputData$environment_mean_afterEFA_T2 and InputData$bas_mean_T2
## t = 5.3045, df = 342, p-value = 2.034e-07
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1750790 0.3706509
## sample estimates:
##       cor 
## 0.2757159

(4)精神的健康の潜在差得点算出

4-1. 精神的健康の潜在差得点を算出

#モデル記述
lcs.health <- '
T1 =~ 1*health1_T1 + m*health2_T1 + n*health3_T1 + o*health4_T1 + p*health5_T1
T2 =~ 1*health1_T2 + m*health2_T2 + n*health3_T2 + o*health4_T2 + p*health5_T2

#誤差
health1_T1 ~~ health1_T1
health2_T1 ~~ health2_T1
health3_T1 ~~ health3_T1
health4_T1 ~~ health4_T1
health5_T1 ~~ health5_T1
health1_T2 ~~ health1_T2
health2_T2 ~~ health2_T2
health3_T2 ~~ health3_T2
health4_T2 ~~ health4_T2
health5_T2 ~~ health5_T2

#2時点間の同一項目間の誤差共分散を定義
health1_T1 ~~ health1_T2 #項目1
health2_T1 ~~ health2_T2 #項目2
health3_T1 ~~ health3_T2 #項目3
health4_T1 ~~ health4_T2 #項目4
health5_T1 ~~ health5_T2 #項目5

#free latent variances and covariances
LC ~~ var.LC*LC
T1 ~~ var.T1*T1
T1 ~~ eta*LC

#define latent difference score (fix loading to 1)
LC =~ 1*T2

#fix latent regression to 1 to define latent difference score
T2 ~ 1*T1

#fix FT2 variance to zero to define latent difference score
T2 ~~ 0*T2

#no correlations between FT2 and other latent variables 
LC + T1 ~~ 0*T2

#means
LC ~ beta*1
T1 ~ alpha*1
'

result.lcs <- lavaan(lcs.health, data = InputData, fixed.x = FALSE, missing = "fiml", meanstructure = TRUE)
summary(result.lcs, fit.measures = TRUE) #結果出力
## lavaan (0.6-1) converged normally after  43 iterations
## 
##   Number of observations                           412
##   Number of missing patterns                         2
## 
##   Estimator                                         ML
##   Model Fit Test Statistic                     191.518
##   Degrees of freedom                                41
##   P-value (Chi-square)                           0.000
## 
## Model test baseline model:
## 
##   Minimum Function Test Statistic             2296.272
##   Degrees of freedom                                45
##   P-value                                        0.000
## 
## User model versus baseline model:
## 
##   Comparative Fit Index (CFI)                    0.933
##   Tucker-Lewis Index (TLI)                       0.927
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -4851.537
##   Loglikelihood unrestricted model (H1)      -4755.778
## 
##   Number of free parameters                         24
##   Akaike (AIC)                                9751.074
##   Bayesian (BIC)                              9847.578
##   Sample-size adjusted Bayesian (BIC)         9771.421
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.094
##   90 Percent Confidence Interval          0.081  0.108
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.059
## 
## Parameter Estimates:
## 
##   Information                                 Observed
##   Observed information based on                Hessian
##   Standard Errors                             Standard
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   T1 =~                                               
##     health1_T1        1.000                           
##     health2_T1 (m)    0.974    0.007  131.369    0.000
##     health3_T1 (n)    0.961    0.009  110.217    0.000
##     health4_T1 (o)    0.926    0.010   89.564    0.000
##     health5_T1 (p)    0.931    0.010   96.719    0.000
##   T2 =~                                               
##     health1_T2        1.000                           
##     health2_T2 (m)    0.974    0.007  131.369    0.000
##     health3_T2 (n)    0.961    0.009  110.217    0.000
##     health4_T2 (o)    0.926    0.010   89.564    0.000
##     health5_T2 (p)    0.931    0.010   96.719    0.000
##   LC =~                                               
##     T2                1.000                           
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   T2 ~                                                
##     T1                1.000                           
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##  .health1_T1 ~~                                       
##    .hlth1_T2          0.000    0.022    0.020    0.984
##  .health2_T1 ~~                                       
##    .hlth2_T2          0.049    0.024    2.004    0.045
##  .health3_T1 ~~                                       
##    .hlth3_T2          0.112    0.035    3.203    0.001
##  .health4_T1 ~~                                       
##    .hlth4_T2          0.153    0.052    2.945    0.003
##  .health5_T1 ~~                                       
##    .hlth5_T2          0.177    0.042    4.266    0.000
##   T1 ~~                                               
##     LC       (eta)   -0.578    0.069   -8.321    0.000
##  .T2 ~~                                               
##     LC                0.000                           
##   T1 ~~                                               
##    .T2                0.000                           
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)
##     LC      (beta)    0.412    0.057    7.255    0.000
##     T1      (alph)    3.640    0.054   67.887    0.000
##    .hlt1_T1           0.000                           
##    .hlt2_T1           0.000                           
##    .hlt3_T1           0.000                           
##    .hlt4_T1           0.000                           
##    .hlt5_T1           0.000                           
##    .hlt1_T2           0.000                           
##    .hlt2_T2           0.000                           
##    .hlt3_T2           0.000                           
##    .hlt4_T2           0.000                           
##    .hlt5_T2           0.000                           
##    .T2                0.000                           
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .hlt1_T1           0.361    0.036   10.023    0.000
##    .hlt2_T1           0.382    0.037   10.328    0.000
##    .hlt3_T1           0.665    0.055   12.089    0.000
##    .hlt4_T1           0.793    0.063   12.637    0.000
##    .hlt5_T1           0.697    0.057   12.255    0.000
##    .hlt1_T2           0.228    0.026    8.669    0.000
##    .hlt2_T2           0.273    0.028    9.630    0.000
##    .hlt3_T2           0.439    0.040   10.946    0.000
##    .hlt4_T2           0.893    0.074   12.055    0.000
##    .hlt5_T2           0.595    0.052   11.383    0.000
##     LC      (v.LC)    1.006    0.091   11.109    0.000
##     T1      (v.T1)    0.984    0.077   12.702    0.000
##    .T2                0.000
#作図
lcs.plot <- semPaths(result.lcs, "std", edge.label.cex=.8, fade = FALSE, gray = TRUE, mar=c(6,1,3,1), style="mx")

4-2. 算出された個々人の潜在得点の結果を抽出

change_score <- predict(result.lcs) 
change_score <- as.data.frame(change_score) #データフレーム型に変換
health_change_score <- change_score %>% select_("LC") #差得点列だけを抽出 
head(health_change_score) #個々人の潜在得点を確認(LC列が差得点)
#潜在差得点の列をInputDataの列に追加
InputData <- bind_cols(InputData, health_change_score)
names(InputData) #列追加されたか確認
##   [1] "ID"                           "gardian_gender_T1"           
##   [3] "gardian_age_T1"               "prefecture_T1"               
##   [5] "area_T1"                      "married_T1"                  
##   [7] "familyincome_T1"              "pinincome_T1"                
##   [9] "job_T1"                       "child_gender_T1"             
##  [11] "hsc1_T1"                      "hsc2_T1"                     
##  [13] "hsc3_T1"                      "hsc4_T1"                     
##  [15] "hsc5_T1"                      "hsc6_T1"                     
##  [17] "hsc7_T1"                      "hsc8_T1"                     
##  [19] "hsc9_T1"                      "hsc10_T1"                    
##  [21] "hsc11_T1"                     "hsc12_T1"                    
##  [23] "health1_T1"                   "health2_T1"                  
##  [25] "health3_T1"                   "health4_T1"                  
##  [27] "health5_T1"                   "panas1_T1"                   
##  [29] "panas2_T1"                    "panas3_T1"                   
##  [31] "panas4_T1"                    "panas5_T1"                   
##  [33] "panas6_T1"                    "panas7_T1"                   
##  [35] "panas8_T1"                    "panas9_T1"                   
##  [37] "panas10_T1"                   "panas11_T1"                  
##  [39] "panas12_T1"                   "panas13_T1"                  
##  [41] "panas14_T1"                   "panas15_T1"                  
##  [43] "panas16_T1"                   "gardian_gender_T2"           
##  [45] "gardian_age_T2"               "prefecture_T2"               
##  [47] "area_T2"                      "married_T2"                  
##  [49] "familyincome_T2"              "pinincome_T2"                
##  [51] "job_T2"                       "child_gender_T2"             
##  [53] "environment1_T2"              "environment2_T2"             
##  [55] "environment3_T2"              "environment4_T2"             
##  [57] "environment5_T2"              "environment6_T2"             
##  [59] "environment7_T2"              "environment8_T2"             
##  [61] "environment9_T2"              "environment10_T2"            
##  [63] "environment11_T2"             "hsc1_T2"                     
##  [65] "hsc2_T2"                      "hsc3_T2"                     
##  [67] "hsc4_T2"                      "hsc5_T2"                     
##  [69] "hsc6_T2"                      "hsc7_T2"                     
##  [71] "hsc8_T2"                      "hsc9_T2"                     
##  [73] "hsc10_T2"                     "hsc11_T2"                    
##  [75] "hsc12_T2"                     "health1_T2"                  
##  [77] "health2_T2"                   "health3_T2"                  
##  [79] "health4_T2"                   "health5_T2"                  
##  [81] "bis1r_T2"                     "bas1_T2"                     
##  [83] "bas2_T2"                      "bas3_T2"                     
##  [85] "bas4_T2"                      "bis2_T2"                     
##  [87] "bas5_T2"                      "bas6_T2"                     
##  [89] "bas7_T2"                      "bis3_T2"                     
##  [91] "bas8_T2"                      "bas9_T2"                     
##  [93] "bis4_T2"                      "bas10_T2"                    
##  [95] "bis5_T2"                      "bas11_T2"                    
##  [97] "bas12_T2"                     "bis6r_T2"                    
##  [99] "bas13_T2"                     "bis7_T2"                     
## [101] "bis1_T2"                      "bis6_T2"                     
## [103] "eoe_mean_T1"                  "na.rm"                       
## [105] "eoe_mean_T2"                  "lst_mean_T1"                 
## [107] "lst_mean_T2"                  "aes_mean_T1"                 
## [109] "aes_mean_T2"                  "hsc_mean_T1"                 
## [111] "hsc_mean_T2"                  "health_mean_T1"              
## [113] "health_mean_T2"               "positive_mean_T1"            
## [115] "negative_mean_T1"             "environment_mean_T2"         
## [117] "bis_mean_T2"                  "bas_mean_T2"                 
## [119] "environment_mean_afterEFA_T2" "LC"

4-3. 潜在差得点の基礎統計量

health_change_score_discriptive <- 
  InputData %>% 
  dplyr::summarise(n = n (), #グループの人数を出力
                   health.lcs.mean = mean (LC), #差得点の平均
                   health1.lcs.sd = sd (LC)) #差得点のSD
health_change_score_discriptive #出力(平均はモデル推定値の切片と同じになっている)

4-4. 潜在差得点のヒストグラム

#png("figure/healthchange_histogram.png", width = 600, height = 400)
health_change_score_histogram <- ggplot(data = InputData, mapping = aes(x = LC, colour = "black")) + 
  geom_histogram(binwidth = 0.2, colour="black") + guides(fill = "none") #視覚化
health_change_score_histogram + theme(plot.subtitle = element_text(vjust = 1), 
    plot.caption = element_text(vjust = 1), 
    axis.title = element_text(size = 16), 
    axis.text = element_text(size = 16)) +labs(x = "精神的健康の潜在差得点", y = "度数")

#dev.off()

4-5. 潜在差得点のシャピロ-ウィルク検定(正規性検定)

shapiro.test(InputData$LC)
## 
##  Shapiro-Wilk normality test
## 
## data:  InputData$LC
## W = 0.9867, p-value = 0.0008022
#結果メモ:p < .05で正規分布ではないと判断。
#結果メモ:正規分布ではないという結果となった。

(5)HSCSのクラスタ抽出

5-1. HSCのT1の下位尺度得点のみのデータセットを作成

#HSCのT1の下位尺度得点のみのデータセットを作成
HSC.data <- InputData %>% select_("eoe_mean_T1", "lst_mean_T1", "aes_mean_T1")
head(HSC.data) #先頭行確認

5-2. Gap統計量を算出し、最適なクラスタ数を決定(参考としてk-meansも分析)

library(cluster)
cluster.number <- clusGap(HSC.data, kmeans, K.max = 10, B = 2000, verbose = interactive())
cluster.number #結果出力 #クラスタ数は1が適切らしい。2~7だと4が適切。
## Clustering Gap statistic ["clusGap"] from call:
## clusGap(x = HSC.data, FUNcluster = kmeans, K.max = 10, B = 2000,     verbose = interactive())
## B=2000 simulated reference sets, k = 1..10; spaceH0="scaledPCA"
##  --> Number of clusters (method 'firstSEmax', SE.factor=1): 1
##           logW   E.logW       gap     SE.sim
##  [1,] 5.481052 6.216275 0.7352232 0.01435799
##  [2,] 5.258224 5.928180 0.6699561 0.01276790
##  [3,] 5.128158 5.832116 0.7039588 0.01432033
##  [4,] 5.048883 5.742403 0.6935198 0.01571735
##  [5,] 4.980838 5.663496 0.6826579 0.01531663
##  [6,] 4.914262 5.590832 0.6765702 0.01555449
##  [7,] 4.858445 5.527313 0.6688684 0.01566573
##  [8,] 4.828178 5.470015 0.6418364 0.01506922
##  [9,] 4.796747 5.417310 0.6205636 0.01554194
## [10,] 4.761201 5.371027 0.6098261 0.01556737
plot(cluster.number) #Gap統計量の視覚化

#4クラスタで分析
c4 <- kmeans(HSC.data, 4, algorithm = "Hartigan-Wong")
c4 #クラスタリング結果の表示
## K-means clustering with 4 clusters of sizes 67, 99, 94, 152
## 
## Cluster means:
##   eoe_mean_T1 lst_mean_T1 aes_mean_T1
## 1    3.495522    3.014925    5.544776
## 2    5.224242    5.924242    5.578283
## 3    3.823404    3.840426    3.550532
## 4    4.669737    4.315789    5.113487
## 
## Clustering vector:
##   [1] 4 3 4 3 4 4 1 2 3 3 3 2 4 2 4 4 3 4 4 1 2 3 3 2 3 4 3 4 2 2 3 4 3 1 3
##  [36] 3 4 1 3 4 4 4 4 3 4 2 1 2 3 4 2 4 2 4 4 3 4 4 1 1 3 2 2 3 2 1 1 3 1 3
##  [71] 3 1 4 4 4 4 2 4 3 3 3 3 1 3 4 3 3 4 2 3 3 2 1 3 4 4 3 2 4 2 4 2 1 1 4
## [106] 2 4 2 2 3 2 1 2 1 3 2 3 1 1 3 2 3 2 2 2 3 2 4 3 3 3 4 4 2 4 3 1 1 4 4
## [141] 4 4 3 1 2 3 1 4 2 1 4 4 2 4 4 3 4 3 4 3 4 2 1 2 4 4 4 1 2 3 2 3 1 2 2
## [176] 4 4 4 4 3 4 1 2 3 3 2 2 2 3 4 4 1 2 2 1 1 3 4 4 2 1 4 1 4 1 4 4 4 4 2
## [211] 4 4 3 3 4 1 3 3 4 4 4 2 4 4 2 4 1 4 3 4 3 4 1 4 4 2 2 3 4 2 2 1 1 2 4
## [246] 1 3 4 1 3 3 4 2 4 3 4 3 4 1 2 3 3 2 4 4 4 3 3 1 4 2 4 1 4 1 3 4 2 1 2
## [281] 4 2 4 4 1 2 4 4 4 2 3 1 1 2 4 3 4 3 4 1 4 2 3 3 4 4 2 2 4 4 2 4 2 2 1
## [316] 4 4 2 2 4 3 1 4 4 4 4 4 1 4 4 2 2 2 4 2 4 2 2 4 4 3 4 1 4 1 4 3 4 2 3
## [351] 1 3 3 2 1 2 4 1 3 4 2 2 4 3 4 4 1 4 4 3 3 2 1 4 4 4 2 3 2 2 4 4 1 1 4
## [386] 4 2 3 2 3 4 1 3 4 4 4 1 2 1 2 3 2 4 2 1 2 2 2 3 1 2 4
## 
## Within cluster sum of squares by cluster:
## [1] 114.7694 147.9844 152.0924 182.0677
##  (between_SS / total_SS =  57.4 %)
## 
## Available components:
## 
## [1] "cluster"      "centers"      "totss"        "withinss"    
## [5] "tot.withinss" "betweenss"    "size"         "iter"        
## [9] "ifault"

5-3. HSCの潜在プロファイル分析

  • tidyLPAパッケージで実行可能。
  • 使用方法はhttps://cran.r-project.org/web/packages/tidyLPA/vignettes/Introduction_to_tidyLPA.html
  • install.packages(“devtools”) #ここでは開発版を使用
  • devtools::install_github(“jrosen48/tidyLPA”) #ここでは開発版を使用
library(tidyLPA)
## tidyLPA provides the functionality to carry out Latent Profile Analysis. Note that tidyLPA is still at the beta stage! 
## Please report any bugs at https://github.com/jrosen48/tidyLPA or send an email to tidylpa@googlegroups.com.

5-3-1. 適切なプロファイル数を検討比較

  • 結果メモ:model2とmodel3で3クラスタがもっともBICが低い。
  • 結果メモ:総合的に判断して3クラスタを採用
  • 結果メモ:モデル4と5がないのはデフォルトらしい。Mplusなら推定できるとのこと(上記URL)。
compare_solutions(HSC.data, eoe_mean_T1, lst_mean_T1, aes_mean_T1)

5-3-2. ほかのプロファイル数のBICとentropyの算出(BIC比較表作成のため)

#プロファイル数1
hsc.profile1 <- estimate_profiles(HSC.data,
                                 eoe_mean_T1, lst_mean_T1, aes_mean_T1,
                                 model = 3,
                                 n_profiles = 1,
                                 return_orig_df = TRUE)
## Fit varying means and variances, covariances fixed to 0 (Model 3) model with 1 profiles.
## LogLik is 1818.697
## BIC is 3673.52
## Entropy is 1
#プロファイル数2
hsc.profile2 <- estimate_profiles(HSC.data,
                                  eoe_mean_T1, lst_mean_T1, aes_mean_T1,
                                  model = 3,
                                  n_profiles = 2,
                                  return_orig_df = TRUE)
## Fit varying means and variances, covariances fixed to 0 (Model 3) model with 2 profiles.
## LogLik is 1772.653
## BIC is 3623.579
## Entropy is 0.825
#プロファイル数3
hsc.profile4 <- estimate_profiles(HSC.data,
                                  eoe_mean_T1, lst_mean_T1, aes_mean_T1,
                                  model = 3,
                                  n_profiles = 3,
                                  return_orig_df = TRUE)
## Fit varying means and variances, covariances fixed to 0 (Model 3) model with 3 profiles.
## LogLik is 1700.307
## BIC is 3521.035
## Entropy is 0.835
#プロファイル数4
hsc.profile4 <- estimate_profiles(HSC.data,
                                  eoe_mean_T1, lst_mean_T1, aes_mean_T1,
                                  model = 3,
                                  n_profiles = 4,
                                  return_orig_df = TRUE)
## Fit varying means and variances, covariances fixed to 0 (Model 3) model with 4 profiles.
## LogLik is 1691.142
## BIC is 3544.851
## Entropy is 0.79
#プロファイル数5
hsc.profile5 <- estimate_profiles(HSC.data,
                                  eoe_mean_T1, lst_mean_T1, aes_mean_T1,
                                  model = 3,
                                  n_profiles = 5,
                                  return_orig_df = TRUE)
## Fit varying means and variances, covariances fixed to 0 (Model 3) model with 5 profiles.
## LogLik is 1676.961
## BIC is 3558.637
## Entropy is 0.784
#プロファイル数6
hsc.profile6 <- estimate_profiles(HSC.data,
                                  eoe_mean_T1, lst_mean_T1, aes_mean_T1,
                                  model = 3,
                                  n_profiles = 6,
                                  return_orig_df = TRUE)
## Fit varying means and variances, covariances fixed to 0 (Model 3) model with 6 profiles.
## LogLik is 1673.968
## BIC is 3594.797
## Entropy is 0.778

5-3-3. 推奨されたプロファイル数3の作図

  • 結果メモ:クラスタ1が全体の40%でHSC群に該当すると思われる。やや割合が多い?
  • 結果メモ:クラスタ2は低HSC群、クラスタ3は平均群。
hsc.profile <- estimate_profiles(HSC.data,
                                 eoe_mean_T1, lst_mean_T1, aes_mean_T1,
                                 model = 3,
                                 n_profiles = 3,
                                 return_orig_df = TRUE)
## Fit varying means and variances, covariances fixed to 0 (Model 3) model with 3 profiles.
## LogLik is 1700.307
## BIC is 3521.035
## Entropy is 0.835
plot_profiles(hsc.profile) #作図(素点)

png("figure/hsc_profile_centered_score.png", width = 600, height = 400)
plot_profiles(hsc.profile, to_center = TRUE, to_scale = TRUE) #作図(標準化得点)
dev.off()
## png 
##   2

5-3-4. 所属クラス列をdataの列に追加

hsc.profile <- select_(hsc.profile, "profile")
names(hsc.profile)
## [1] "profile"
InputData <- bind_cols(InputData, hsc.profile)
names(InputData) #列追加されたか確認
##   [1] "ID"                           "gardian_gender_T1"           
##   [3] "gardian_age_T1"               "prefecture_T1"               
##   [5] "area_T1"                      "married_T1"                  
##   [7] "familyincome_T1"              "pinincome_T1"                
##   [9] "job_T1"                       "child_gender_T1"             
##  [11] "hsc1_T1"                      "hsc2_T1"                     
##  [13] "hsc3_T1"                      "hsc4_T1"                     
##  [15] "hsc5_T1"                      "hsc6_T1"                     
##  [17] "hsc7_T1"                      "hsc8_T1"                     
##  [19] "hsc9_T1"                      "hsc10_T1"                    
##  [21] "hsc11_T1"                     "hsc12_T1"                    
##  [23] "health1_T1"                   "health2_T1"                  
##  [25] "health3_T1"                   "health4_T1"                  
##  [27] "health5_T1"                   "panas1_T1"                   
##  [29] "panas2_T1"                    "panas3_T1"                   
##  [31] "panas4_T1"                    "panas5_T1"                   
##  [33] "panas6_T1"                    "panas7_T1"                   
##  [35] "panas8_T1"                    "panas9_T1"                   
##  [37] "panas10_T1"                   "panas11_T1"                  
##  [39] "panas12_T1"                   "panas13_T1"                  
##  [41] "panas14_T1"                   "panas15_T1"                  
##  [43] "panas16_T1"                   "gardian_gender_T2"           
##  [45] "gardian_age_T2"               "prefecture_T2"               
##  [47] "area_T2"                      "married_T2"                  
##  [49] "familyincome_T2"              "pinincome_T2"                
##  [51] "job_T2"                       "child_gender_T2"             
##  [53] "environment1_T2"              "environment2_T2"             
##  [55] "environment3_T2"              "environment4_T2"             
##  [57] "environment5_T2"              "environment6_T2"             
##  [59] "environment7_T2"              "environment8_T2"             
##  [61] "environment9_T2"              "environment10_T2"            
##  [63] "environment11_T2"             "hsc1_T2"                     
##  [65] "hsc2_T2"                      "hsc3_T2"                     
##  [67] "hsc4_T2"                      "hsc5_T2"                     
##  [69] "hsc6_T2"                      "hsc7_T2"                     
##  [71] "hsc8_T2"                      "hsc9_T2"                     
##  [73] "hsc10_T2"                     "hsc11_T2"                    
##  [75] "hsc12_T2"                     "health1_T2"                  
##  [77] "health2_T2"                   "health3_T2"                  
##  [79] "health4_T2"                   "health5_T2"                  
##  [81] "bis1r_T2"                     "bas1_T2"                     
##  [83] "bas2_T2"                      "bas3_T2"                     
##  [85] "bas4_T2"                      "bis2_T2"                     
##  [87] "bas5_T2"                      "bas6_T2"                     
##  [89] "bas7_T2"                      "bis3_T2"                     
##  [91] "bas8_T2"                      "bas9_T2"                     
##  [93] "bis4_T2"                      "bas10_T2"                    
##  [95] "bis5_T2"                      "bas11_T2"                    
##  [97] "bas12_T2"                     "bis6r_T2"                    
##  [99] "bas13_T2"                     "bis7_T2"                     
## [101] "bis1_T2"                      "bis6_T2"                     
## [103] "eoe_mean_T1"                  "na.rm"                       
## [105] "eoe_mean_T2"                  "lst_mean_T1"                 
## [107] "lst_mean_T2"                  "aes_mean_T1"                 
## [109] "aes_mean_T2"                  "hsc_mean_T1"                 
## [111] "hsc_mean_T2"                  "health_mean_T1"              
## [113] "health_mean_T2"               "positive_mean_T1"            
## [115] "negative_mean_T1"             "environment_mean_T2"         
## [117] "bis_mean_T2"                  "bas_mean_T2"                 
## [119] "environment_mean_afterEFA_T2" "LC"                          
## [121] "profile"
head(InputData) #先頭行確認

5-3-5. HSCプロファイル1~3の名前変更

InputData <- InputData %>%
  mutate(hsc.profile = recode(profile,
                            "1" = "medium",
                            "2" = "low",
                            "3" = "hsc"))
head(InputData)   

5-3-6. HSCグループごとの平均値、SD

discriptive_HSCS_by_profile <- 
  InputData %>%
  dplyr::group_by(hsc.profile) %>% #性別でグルーピング
  dplyr::summarise(n = n (), #グループの人数を出力
                   hsc_T1_mean = mean (hsc_mean_T1), #hsc_T1の平均
                   hsc_T1_sd = sd (hsc_mean_T1), #hcs_T1のSD
                   eoe_T1_mean = mean (eoe_mean_T1), #eoe_T1の平均
                   eoe_T1_sd = sd (eoe_mean_T1), #eoe_T1のSD
                   lst_T1_mean = mean (lst_mean_T1), #lst_T1の平均
                   lst_T1_sd = sd (lst_mean_T1), #lst_T1のSD
                   aes_T1_mean = mean (aes_mean_T1), #aes_T1の平均
                   aes_T1_sd = sd (aes_mean_T1), #aes_T1のSD
                   environment_mean = mean (environment_mean_afterEFA_T2), #environment_mean_afterEFA_T2の平均
                   environment_sd = sd (environment_mean_afterEFA_T2), #environment_mean_afterEFA_T2のSD
                   health_improvement = mean (LC), #精神的健康変化の平均
                   health_sd = sd (LC)) #精神的健康変化のSD
discriptive_HSCS_by_profile
InputData %>%
  drop_na() %>% #欠損値をデータセットから除外
  dplyr::group_by(hsc.profile) %>% #性別でグルーピング
  dplyr::summarise(n = n (), #グループの人数を出力
                   environment_mean = mean (environment_mean_afterEFA_T2), #environment_mean_afterEFA_T2の平均
                   environment_sd = sd (environment_mean_afterEFA_T2)) #environment_mean_afterEFA_T2のSD

(6)環境変化→健康変化の平均単回帰(HSPプロファイルごと)

6-1. 各HSCグループの相関係数

#データのグループ化

#hscのグループ
hsc.student <- InputData %>%
  filter(hsc.profile == "hsc")

#低hscのグループ
low.student <- InputData %>%
  filter(hsc.profile == "low")

#中hscのグループ
medium.student <- InputData %>%
  filter(hsc.profile == "medium")

#相関係数
cor.test(hsc.student$environment_mean_afterEFA_T2, hsc.student$LC, method = "pearson") #HSCグループ
## 
##  Pearson's product-moment correlation
## 
## data:  hsc.student$environment_mean_afterEFA_T2 and hsc.student$LC
## t = 4.0461, df = 132, p-value = 8.816e-05
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1722874 0.4750010
## sample estimates:
##       cor 
## 0.3321704
cor.test(low.student$environment_mean_afterEFA_T2, low.student$LC, method = "pearson") #低HSCグループ
## 
##  Pearson's product-moment correlation
## 
## data:  low.student$environment_mean_afterEFA_T2 and low.student$LC
## t = 0.88344, df = 41, p-value = 0.3821
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1706740  0.4197876
## sample estimates:
##      cor 
## 0.136676
cor.test(medium.student$environment_mean_afterEFA_T2, medium.student$LC, method = "pearson") #中HSCグループ
## 
##  Pearson's product-moment correlation
## 
## data:  medium.student$environment_mean_afterEFA_T2 and medium.student$LC
## t = 3.2977, df = 165, p-value = 0.001194
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1005990 0.3859526
## sample estimates:
##       cor 
## 0.2486637

6-2. HSCグループの回帰分析

  • 結果メモ:係数 = 0.32, p < .001, R^2 = 0.11, F(1.132) = 16.37
lm.hsc <- lm(LC ~ environment_mean_afterEFA_T2, data = hsc.student)
summary(lm.hsc)
## 
## Call:
## lm(formula = LC ~ environment_mean_afterEFA_T2, data = hsc.student)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.6240 -0.4691 -0.1123  0.6180  2.4222 
## 
## Coefficients:
##                              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                  -0.93972    0.37478  -2.507   0.0134 *  
## environment_mean_afterEFA_T2  0.32363    0.07999   4.046 8.82e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.8983 on 132 degrees of freedom
##   (30 observations deleted due to missingness)
## Multiple R-squared:  0.1103, Adjusted R-squared:  0.1036 
## F-statistic: 16.37 on 1 and 132 DF,  p-value: 8.816e-05
confint(lm.hsc, level = 0.95)#95%CI
##                                   2.5 %     97.5 %
## (Intercept)                  -1.6810700 -0.1983751
## environment_mean_afterEFA_T2  0.1654119  0.4818558

6-3. 低HSCグループの回帰分析

  • 結果メモ:すべて非有意
  • 結果メモ:b = 0.14, p = 0.382, R^2 = 0.02, F(1,41)=0.78
lm.low <- lm(LC ~ environment_mean_afterEFA_T2, data = low.student)
summary(lm.low)
## 
## Call:
## lm(formula = LC ~ environment_mean_afterEFA_T2, data = low.student)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.62455 -0.62053 -0.03509  0.63428  2.44931 
## 
## Coefficients:
##                              Estimate Std. Error t value Pr(>|t|)
## (Intercept)                   -0.3896     0.7556  -0.516    0.609
## environment_mean_afterEFA_T2   0.1416     0.1603   0.883    0.382
## 
## Residual standard error: 1.046 on 41 degrees of freedom
##   (10 observations deleted due to missingness)
## Multiple R-squared:  0.01868,    Adjusted R-squared:  -0.005254 
## F-statistic: 0.7805 on 1 and 41 DF,  p-value: 0.3821
confint(lm.low, level = 0.95)#95%CI
##                                   2.5 %    97.5 %
## (Intercept)                  -1.9155792 1.1363355
## environment_mean_afterEFA_T2 -0.1821134 0.4653408

6-4. 中HSCグループの回帰分析

  • 結果メモ:b= 0.29, p < .01, R = 0.06, F(1.165) = 10.87
lm.medium <- lm(LC ~ environment_mean_afterEFA_T2, data = medium.student)
summary(lm.medium)
## 
## Call:
## lm(formula = LC ~ environment_mean_afterEFA_T2, data = medium.student)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.96549 -0.48647 -0.05988  0.58358  2.87193 
## 
## Coefficients:
##                              Estimate Std. Error t value Pr(>|t|)   
## (Intercept)                  -0.92049    0.39895  -2.307  0.02228 * 
## environment_mean_afterEFA_T2  0.29004    0.08795   3.298  0.00119 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.8464 on 165 degrees of freedom
##   (28 observations deleted due to missingness)
## Multiple R-squared:  0.06183,    Adjusted R-squared:  0.05615 
## F-statistic: 10.87 on 1 and 165 DF,  p-value: 0.001194
confint(lm.medium, level = 0.95)#95%CI
##                                  2.5 %     97.5 %
## (Intercept)                  -1.708195 -0.1327787
## environment_mean_afterEFA_T2  0.116383  0.4636898

6-5. 各HSCグループの散布図と回帰直線

  • 各グループの全体図(1枚目)
  • 各グループの個別図(2枚目)

6-5-1. 各グループ全体

png("figure/hsc_plot1.png", width = 600, height = 400)
plot1 <- ggplot(data = InputData, aes(x = environment_mean_afterEFA_T2, y = LC, group = factor(hsc.profile), colour = factor(hsc.profile))) + 
  geom_point() +
  geom_smooth(method = "lm") +
  theme_classic(base_size = 14, base_family = "serif") +
  labs(y = "mental health improvement", colour = "profiles")
plot1 <- plot1 + labs(x = "perceived school environment change (1 = negative change, 4 = no change, 7 = positive change)") #1枚で作図
  #メモ;xラベルがなぜか変化しないので、くどいけど2行で作図。これだと変化する。
print(plot1)
#dev.off()

6-5-2. 各グループ個別

#png("figure/hsc_plot2.png", width = 800, height = 400)
plot2 <- ggplot(data = InputData, aes(x = environment_mean_afterEFA_T2, y = LC)) + 
  geom_point() +
  geom_smooth(method = "lm") +
  facet_wrap(~ hsc.profile) #並べて作図
plot2 <- plot2 + theme(plot.subtitle = element_text(vjust = 1), 
    plot.caption = element_text(vjust = 1), 
    axis.title = element_text(size = 14), 
    axis.text = element_text(size = 12), 
    axis.text.x = element_text(size = 12), 
    legend.title = element_text(size = 9)) +labs(x = "perceived school environment change (1 = negative change, 4 = no change, 7 = positive change)", 
    y = "mental health improvement") #並べて作図
print(plot2)

#dev.off()

(7)HSCグループごとに分位点回帰(感度分析としての位置づけ)

library(quantreg)
## Loading required package: SparseM
## 
## Attaching package: 'SparseM'
## The following object is masked from 'package:base':
## 
##     backsolve
set.seed(1234) #乱数set
  • リサンプリング数2000
  • wild法によるブートストラッピング

7-1. HSCグループ

fit.hsc <- rq(LC ~ environment_mean_afterEFA_T2, data = hsc.student, tau = seq(0, 1, 0.25))
summary(fit.hsc, se = "boot", R = 2000, bsmethod= "wild")
## 
## Call: rq(formula = LC ~ environment_mean_afterEFA_T2, tau = seq(0, 
##     1, 0.25), data = hsc.student)
## 
## tau: [1] 0
## 
## Coefficients:
##                              Value    Std. Error t value  Pr(>|t|)
## (Intercept)                  -4.37086  0.00000       -Inf  0.00000
## environment_mean_afterEFA_T2  0.56278  0.00000        Inf  0.00000
## 
## Call: rq(formula = LC ~ environment_mean_afterEFA_T2, tau = seq(0, 
##     1, 0.25), data = hsc.student)
## 
## tau: [1] 0.25
## 
## Coefficients:
##                              Value    Std. Error t value  Pr(>|t|)
## (Intercept)                  -1.64059  0.55030   -2.98125  0.00342
## environment_mean_afterEFA_T2  0.36163  0.10694    3.38161  0.00095
## 
## Call: rq(formula = LC ~ environment_mean_afterEFA_T2, tau = seq(0, 
##     1, 0.25), data = hsc.student)
## 
## tau: [1] 0.5
## 
## Coefficients:
##                              Value    Std. Error t value  Pr(>|t|)
## (Intercept)                  -0.42385  0.46214   -0.91714  0.36074
## environment_mean_afterEFA_T2  0.19441  0.09404    2.06732  0.04066
## 
## Call: rq(formula = LC ~ environment_mean_afterEFA_T2, tau = seq(0, 
##     1, 0.25), data = hsc.student)
## 
## tau: [1] 0.75
## 
## Coefficients:
##                              Value    Std. Error t value  Pr(>|t|)
## (Intercept)                  -0.42581  0.62107   -0.68560  0.49416
## environment_mean_afterEFA_T2  0.34975  0.12876    2.71624  0.00749
## 
## Call: rq(formula = LC ~ environment_mean_afterEFA_T2, tau = seq(0, 
##     1, 0.25), data = hsc.student)
## 
## tau: [1] 1
## 
## Coefficients:
##                              Value   Std. Error t value Pr(>|t|)
## (Intercept)                  1.78577 0.00000        Inf 0.00000 
## environment_mean_afterEFA_T2 0.24701 0.00000        Inf 0.00000

7-2. 低HSCグループ

fit.low <- rq(LC ~ environment_mean_afterEFA_T2, data = low.student, tau = seq(0, 1 , 0.25))
summary(fit.low, se = "boot", R = 2000, bsmethod= "wild")
## 
## Call: rq(formula = LC ~ environment_mean_afterEFA_T2, tau = seq(0, 
##     1, 0.25), data = low.student)
## 
## tau: [1] 0
## 
## Coefficients:
##                              Value    Std. Error t value  Pr(>|t|)
## (Intercept)                  -5.01702  0.00000       -Inf  0.00000
## environment_mean_afterEFA_T2  0.73505  0.00000        Inf  0.00000
## 
## Call: rq(formula = LC ~ environment_mean_afterEFA_T2, tau = seq(0, 
##     1, 0.25), data = low.student)
## 
## tau: [1] 0.25
## 
## Coefficients:
##                              Value    Std. Error t value  Pr(>|t|)
## (Intercept)                  -2.00651  1.47776   -1.35780  0.18195
## environment_mean_afterEFA_T2  0.29497  0.27743    1.06326  0.29389
## 
## Call: rq(formula = LC ~ environment_mean_afterEFA_T2, tau = seq(0, 
##     1, 0.25), data = low.student)
## 
## tau: [1] 0.5
## 
## Coefficients:
##                              Value    Std. Error t value  Pr(>|t|)
## (Intercept)                  -0.51480  0.80362   -0.64060  0.52534
## environment_mean_afterEFA_T2  0.15547  0.17042    0.91230  0.36694
## 
## Call: rq(formula = LC ~ environment_mean_afterEFA_T2, tau = seq(0, 
##     1, 0.25), data = low.student)
## 
## tau: [1] 0.75
## 
## Coefficients:
##                              Value    Std. Error t value  Pr(>|t|)
## (Intercept)                   0.97555  0.88651    1.10043  0.27756
## environment_mean_afterEFA_T2 -0.00425  0.17387   -0.02447  0.98060
## 
## Call: rq(formula = LC ~ environment_mean_afterEFA_T2, tau = seq(0, 
##     1, 0.25), data = low.student)
## 
## tau: [1] 1
## 
## Coefficients:
##                              Value   Std. Error t value Pr(>|t|)
## (Intercept)                  1.83570 0.00000        Inf 0.00000 
## environment_mean_afterEFA_T2 0.19004 0.00000        Inf 0.00000

7-3. 中HSCグループ

fit.medium <- rq(LC ~ environment_mean_afterEFA_T2, data = medium.student, tau = seq(0, 1 , 0.25))
summary(fit.medium, se = "boot", R = 2000, bsmethod= "wild")
## 
## Call: rq(formula = LC ~ environment_mean_afterEFA_T2, tau = seq(0, 
##     1, 0.25), data = medium.student)
## 
## tau: [1] 0
## 
## Coefficients:
##                              Value    Std. Error t value  Pr(>|t|)
## (Intercept)                  -8.81072  0.00000       -Inf  0.00000
## environment_mean_afterEFA_T2  1.41569  0.00000        Inf  0.00000
## 
## Call: rq(formula = LC ~ environment_mean_afterEFA_T2, tau = seq(0, 
##     1, 0.25), data = medium.student)
## 
## tau: [1] 0.25
## 
## Coefficients:
##                              Value    Std. Error t value  Pr(>|t|)
## (Intercept)                  -2.05810  0.40976   -5.02271  0.00000
## environment_mean_afterEFA_T2  0.43214  0.08146    5.30504  0.00000
## 
## Call: rq(formula = LC ~ environment_mean_afterEFA_T2, tau = seq(0, 
##     1, 0.25), data = medium.student)
## 
## tau: [1] 0.5
## 
## Coefficients:
##                              Value    Std. Error t value  Pr(>|t|)
## (Intercept)                  -1.07526  0.45147   -2.38168  0.01837
## environment_mean_afterEFA_T2  0.31063  0.09510    3.26630  0.00133
## 
## Call: rq(formula = LC ~ environment_mean_afterEFA_T2, tau = seq(0, 
##     1, 0.25), data = medium.student)
## 
## tau: [1] 0.75
## 
## Coefficients:
##                              Value   Std. Error t value Pr(>|t|)
## (Intercept)                  0.28294 0.59740    0.47361 0.63640 
## environment_mean_afterEFA_T2 0.15206 0.12696    1.19765 0.23277 
## 
## Call: rq(formula = LC ~ environment_mean_afterEFA_T2, tau = seq(0, 
##     1, 0.25), data = medium.student)
## 
## tau: [1] 1
## 
## Coefficients:
##                              Value    Std. Error t value  Pr(>|t|)
## (Intercept)                   5.78011  0.00000        Inf  0.00000
## environment_mean_afterEFA_T2 -0.61083  0.00000       -Inf  0.00000

(8)階層的重回帰分析

ステップ1で「性別」、ステップ2で「知覚された学校環境変化」「HSCS」、ステップ3で「知覚された学校環境変化×HSCS」を独立変数として順に投入。独立変数は「性別」以外、中心化。HSCSは1時点目の得点を用いる。従属変数はwell-beingの潜在差得点。 参考資料として:chrome-extension://oemmndcbldboiebfnladdacbdfmadadm/http://cogpsy.educ.kyoto-u.ac.jp/personal/Kusumi/datasem13/shinya2.pdf

8-1. 中心化得点の算出

dat <- InputData %>% drop_na() %>% select_("hsc_mean_T1", "environment_mean_afterEFA_T2", "LC", "child_gender_T1") #na削除したうえで必要な変数抽出
hscs_c <- dat$hsc_mean_T1 - mean(dat$hsc_mean_T1) #HSCSの中心化
env_c <- dat$environment_mean_afterEFA_T2 - mean(dat$environment_mean_afterEFA_T2) #知覚された学校環境変化の中心化

wellbeing <- dat$LC #well-beingの潜在差得点の名前変更
gender <- dat$child_gender_T1 #性別T1の変数名変更

8-2. 中心化できたか確認

cor(data.frame(dat$child_gender_T1, dat$hsc_mean_T1, dat$environment_mean_afterEFA_T2, dat$LC))#中心化前の変数
##                                  dat.child_gender_T1 dat.hsc_mean_T1
## dat.child_gender_T1                       1.00000000      0.16152287
## dat.hsc_mean_T1                           0.16152287      1.00000000
## dat.environment_mean_afterEFA_T2         -0.09337277      0.02003445
## dat.LC                                   -0.00936455      0.10232572
##                                  dat.environment_mean_afterEFA_T2
## dat.child_gender_T1                                   -0.09337277
## dat.hsc_mean_T1                                        0.02003445
## dat.environment_mean_afterEFA_T2                       1.00000000
## dat.LC                                                 0.25558481
##                                       dat.LC
## dat.child_gender_T1              -0.00936455
## dat.hsc_mean_T1                   0.10232572
## dat.environment_mean_afterEFA_T2  0.25558481
## dat.LC                            1.00000000
cor(data.frame(gender, hscs_c, env_c, wellbeing))
##                gender     hscs_c       env_c   wellbeing
## gender     1.00000000 0.16152287 -0.09337277 -0.00936455
## hscs_c     0.16152287 1.00000000  0.02003445  0.10232572
## env_c     -0.09337277 0.02003445  1.00000000  0.25558481
## wellbeing -0.00936455 0.10232572  0.25558481  1.00000000

8-3. 階層的重回帰分析ステップ1

「性別」だけ投入。結果メモ:モデルは非有意

reg1 <- lm(wellbeing ~ gender)
summary(reg1)
## 
## Call:
## lm(formula = wellbeing ~ gender)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -3.10890 -0.53642 -0.00724  0.56920  2.67759 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.43584    0.07620    5.72 2.63e-08 ***
## gender      -0.01724    0.10758   -0.16    0.873    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.9238 on 293 degrees of freedom
## Multiple R-squared:  8.769e-05,  Adjusted R-squared:  -0.003325 
## F-statistic: 0.0257 on 1 and 293 DF,  p-value: 0.8728

8-3. 階層的重回帰分析ステップ2

「知覚された学校環境変化」と「HSCS」を追加投入。結果メモ:モデルは有意。学校環境が正の効果。

reg2 <- lm(wellbeing ~ gender + env_c + hscs_c)
summary(reg2)
## 
## Call:
## lm(formula = wellbeing ~ gender + env_c + hscs_c)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.90240 -0.49893 -0.08848  0.62892  2.57619 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.428522   0.074221   5.774 1.99e-08 ***
## gender      -0.002652   0.105725  -0.025   0.9800    
## env_c        0.263496   0.058906   4.473 1.11e-05 ***
## hscs_c       0.112978   0.066263   1.705   0.0893 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.8917 on 291 degrees of freedom
## Multiple R-squared:  0.07478,    Adjusted R-squared:  0.06524 
## F-statistic:  7.84 on 3 and 291 DF,  p-value: 4.764e-05
anova(reg1, reg2) #R^2の増加量の検定

8-4. 階層的重回帰分析ステップ3

「知覚された学校環境変化」と「HSCS」の交互作用項を追加投入。結果メモ:モデルは非有意。交互作用項も非有意。

reg3 <- lm(wellbeing ~ gender + env_c + hscs_c + env_c:hscs_c)
summary(reg3)
## 
## Call:
## lm(formula = wellbeing ~ gender + env_c + hscs_c + env_c:hscs_c)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.90460 -0.50746 -0.09731  0.62458  2.42529 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   0.4263640  0.0742011   5.746 2.31e-08 ***
## gender       -0.0008841  0.1056737  -0.008   0.9933    
## env_c         0.2590318  0.0589968   4.391 1.59e-05 ***
## hscs_c        0.1242824  0.0669389   1.857   0.0644 .  
## env_c:hscs_c  0.0902023  0.0778360   1.159   0.2475    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.8912 on 290 degrees of freedom
## Multiple R-squared:  0.07904,    Adjusted R-squared:  0.06634 
## F-statistic: 6.222 on 4 and 290 DF,  p-value: 8.133e-05
anova(reg2, reg3) #R^2の増加量の検定

8-5. 単純傾斜検定

交互作用項は有意ではなかったが、一応単純傾斜検定してみる

8-5-1. HSCSの+1SDと-1SD変数の作成

hscs_h <- dat$hsc_mean_T1 - (mean(dat$hsc_mean_T1, na.rm = TRUE) + sd(dat$hsc_mean_T1, na.rm = TRUE)) #HSCS +1SD
hscs_l <- dat$hsc_mean_T1 - (mean(dat$hsc_mean_T1, na.rm = TRUE) - sd(dat$hsc_mean_T1, na.rm = TRUE)) #HSCS -1SD

8-5-2. +1SD推定

結果の出力は、env_cをみる。結果メモ:env_cは有意。後述の-1SDより効果高いようにみえる。

result_h <- lm(wellbeing ~ gender + env_c + hscs_h + env_c:hscs_h)
summary(result_h)
## 
## Call:
## lm(formula = wellbeing ~ gender + env_c + hscs_h + env_c:hscs_h)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.90460 -0.50746 -0.09731  0.62458  2.42529 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   0.5252657  0.0960811   5.467 9.88e-08 ***
## gender       -0.0008841  0.1056737  -0.008   0.9933    
## env_c         0.3308132  0.0827044   4.000 8.05e-05 ***
## hscs_h        0.1242824  0.0669389   1.857   0.0644 .  
## env_c:hscs_h  0.0902023  0.0778360   1.159   0.2475    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.8912 on 290 degrees of freedom
## Multiple R-squared:  0.07904,    Adjusted R-squared:  0.06634 
## F-statistic: 6.222 on 4 and 290 DF,  p-value: 8.133e-05

8-5-3. -1SD推定

結果の出力は、env_cをみる。結果メモ:env_cは有意。効果は+1SDより小さめ。

result_l <- lm(wellbeing ~ gender + env_c + hscs_l + env_c:hscs_l)
summary(result_l)
## 
## Call:
## lm(formula = wellbeing ~ gender + env_c + hscs_l + env_c:hscs_l)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.90460 -0.50746 -0.09731  0.62458  2.42529 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   0.3274622  0.0863434   3.793 0.000181 ***
## gender       -0.0008841  0.1056737  -0.008 0.993331    
## env_c         0.1872504  0.0882865   2.121 0.034775 *  
## hscs_l        0.1242824  0.0669389   1.857 0.064374 .  
## env_c:hscs_l  0.0902023  0.0778360   1.159 0.247460    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.8912 on 290 degrees of freedom
## Multiple R-squared:  0.07904,    Adjusted R-squared:  0.06634 
## F-statistic: 6.222 on 4 and 290 DF,  p-value: 8.133e-05

8-6. pequodパッケージで階層的重回帰分析(検算)

参考資料としてhttps://www.slideshare.net/makotohirakawa3/mra-42251907

library(pequod)
## Loading required package: car
## Loading required package: carData
## 
## Attaching package: 'car'
## The following object is masked from 'package:psych':
## 
##     logit
## The following object is masked from 'package:dplyr':
## 
##     recode
## The following object is masked from 'package:purrr':
## 
##     some
model <- lmres(LC ~ child_gender_T1 + environment_mean_afterEFA_T2 + hsc_mean_T1 + environment_mean_afterEFA_T2:hsc_mean_T1, centered = c("environment_mean_afterEFA_T2", "hsc_mean_T1"), data = dat) #交互作用の検討
summary(model)
## Formula:
## LC ~ child_gender_T1 + environment_mean_afterEFA_T2 + hsc_mean_T1 + 
##     environment_mean_afterEFA_T2.XX.hsc_mean_T1
## <environment: 0x000000001fad2c10>
## 
## Models
##          R     R^2   Adj. R^2    F     df1  df2  p.value    
## Model 0.2811 0.0790    0.0663 6.2225 4.0000  290 8.1e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residuals
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## -2.9046 -0.5075 -0.0973  0.0000  0.6246  2.4253 
## 
## Coefficients
##                                             Estimate   StdErr  t.value
## (Intercept)                                  0.42636  0.07420  5.74606
## child_gender_T1                             -0.00088  0.10567 -0.00837
## environment_mean_afterEFA_T2                 0.25903  0.05900  4.39061
## hsc_mean_T1                                  0.12428  0.06694  1.85665
## environment_mean_afterEFA_T2.XX.hsc_mean_T1  0.09020  0.07784  1.15888
##                                                beta p.value    
## (Intercept)                                         < 2e-16 ***
## child_gender_T1                             -0.0005 0.99333    
## environment_mean_afterEFA_T2                 0.2492   2e-05 ***
## hsc_mean_T1                                  0.1072 0.06437 .  
## environment_mean_afterEFA_T2.XX.hsc_mean_T1  0.0662 0.24746    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Collinearity
##                                                VIF Tolerance
## child_gender_T1                             1.0369    0.9644
## environment_mean_afterEFA_T2                1.0144    0.9858
## hsc_mean_T1                                 1.0504    0.9520
## environment_mean_afterEFA_T2.XX.hsc_mean_T1 1.0273    0.9734

8-7. pequodパッケージで単純傾斜検定(検算)

model_ss <- simpleSlope(model, pred ="environment_mean_afterEFA_T2", mod1 = "hsc_mean_T1")
summary(model_ss)
## 
## ** Estimated points of LC  **
## 
##                          Low environment_mean_afterEFA_T2 (-1 SD)
## Low hsc_mean_T1 (-1 SD)                                    0.1613
## High hsc_mean_T1 (+1 SD)                                   0.2317
##                          High environment_mean_afterEFA_T2 (+1 SD)
## Low hsc_mean_T1 (-1 SD)                                     0.4936
## High hsc_mean_T1 (+1 SD)                                    0.8188
## 
## 
## 
## ** Simple Slopes analysis ( df= 290 ) **
## 
##                          simple slope standard error t-value p.value    
## Low hsc_mean_T1 (-1 SD)        0.1873         0.0883    2.12  0.0348 *  
## High hsc_mean_T1 (+1 SD)       0.3308         0.0827    4.00  0.0001 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## 
## ** Bauer & Curran 95% CI **
## 
##             lower CI upper CI
## hsc_mean_T1  -0.8648    4.104
PlotSlope(model_ss) #作図

END